Moving players to a room when a dialog button is pressed HELP

So i’m pretty new to Lua and I have decided to do some small work around my friend Wills server. One of the things I have been working on is trying to make it so when a player joins a certain job it moves them to a room/office.

Here is some of the code I used to make that kind of work.

	GAMEMODE.DialogPanel:AddDialog("I'll serve to my best ability, sir!", LEAVE_DIALOG);
	LocalPlayer():SetPos( Vector(-10114, 10055, -557))
	LocalPlayer():SetAngles( Angle(0.000, 1.100, 0.000))
	LocalPlayer():Notify("You have been moved to the dispatchers office, you must remain here while on duty!")
end

end

I noticed that when you hit the button to join the job, the screen flickered for a second and it made me wonder what was happening. So I recorded myself doing it and went through the frames 1x1 in Sony Vegas. Turns out when you hit the button you get moved to the vector but shortly after it just puts you back to where you began.

Would be wonderful if anyone knew what was causing this and as I said I am pretty new to Lua so don’t laugh at me xD

Can’t you just set the spawn position of jobs? Are you using DarkRP?

You’re forcing the localplayer to do serverside work.

Sorry guys I realised that these functions can only be executed through server side due to security. All done now I got what I wanted to do working. Thanks for the responses though. :smiley: