Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me with a teleport command script?

Asked by 11 years ago

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

Log in to vote
1
Answered by 11 years ago

Try using this:

01game.Players.PlayerAdded:connect(function(pName)
02    pName.Chatted:connect(function (msg)
03        if string.sub(string.lower(msg),1,3) == "tp/" then
04            local requester = pName
05            local tpr = game.Lighting.TpRequestOrig:clone()
06            tpr.Frame.textST.Text = (requester).." would like to teleport to you. Do you aprove? Say (/yes) or (/no)"
07            local nm = string.sub(string.lower(msg),4)
08            for _,v in pairs(game.Players:GetChildren()) do
09                if string.lower(nm) == string.lower(v) then
10                    tpr.Parent = v.PlayerGui
11                end
12            end
13        elseif string.sub(string.lower(msg),1,4) == "/yes" then
14            requester:MoveTo(nm.Character.Torso.Position)
15            trp:Destroy()
16        elseif string.sub(string.lower(msg),1,3) == "/no" then
17            tpr:Destroy()
18        end
19    end)
20end)
0
That will not detect if the tp requester is an admin. I don't see why an admin would need to request. wattleman 90 — 11y
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. ctrlboy 5 — 11y
0
Well, you would have to take out the teleport command in the admin script. And yes, it can be done in a GUI. wattleman 90 — 11y
Ad
Log in to vote
0
Answered by
Vathriel 510 Moderation Voter
11 years ago

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

Answer this question