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 10 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 10 years ago

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)

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 — 10y
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 — 10y
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 — 10y
Ad
Log in to vote
0
Answered by
Vathriel 510 Moderation Voter
10 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