Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone help me with a teleport command script?

Hi, I need help with an idea I've had for an admin only teleport command script that when you want to teleport to another player, the player your wanting to teleport to will have a gui to confirm the teleport.

I don't really have any code for this so I was wondering if anyone here could help me out. I've already got my primary commant script sorted out with removing the ability to use its teleport command.

2 answers

✓ Accepted answer

Try using this:

game.Players.PlayerAdded:connect(function(pName)
	pName.Chatted:connect(function (msg)
		if string.sub(string.lower(msg),1,3) == "tp/" then
			local requester = pName
			local tpr = game.Lighting.TpRequestOrig:clone()
			tpr.Frame.textST.Text = (requester).." would like to teleport to you. Do you aprove? Say (/yes) or (/no)"
			local nm = string.sub(string.lower(msg),4)
			for _,v in pairs(game.Players:GetChildren()) do 
				if string.lower(nm) == string.lower(v) then 
					tpr.Parent = v.PlayerGui
				end
			end	
		elseif string.sub(string.lower(msg),1,4) == "/yes" then
			requester:MoveTo(nm.Character.Torso.Position)
			trp:Destroy()
		elseif string.sub(string.lower(msg),1,3) == "/no" then
			tpr:Destroy()
		end
	end)
end)

3 comments

0

That will not detect if the tp requester is an admin. I don't see why an admin would need to request.

0

Is it possible you to make it for admin and maybe have buttons instead of typing /yes or /no? I'm trying to fix this problem where my game admins teleport me when I'm in my custom built car and I would always lose the car and have to reinsert it.

0

Well, you would have to take out the teleport command in the admin script. And yes, it can be done in a GUI.

Use _G to send data between multiple scripts. This will not work with local scripts. Plan accordingly, you will also need a table.

This discussion is preserved as it was. New answers, comments, and votes are closed.