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

How can I edit this to do this?

Asked by 10 years ago

So I want it to make it where if a player clicks on this gui button I have, I want it to teleport the player who clicked it, so how can I edit this?

for i, v in   pairs(game.Players:GetChildren()) do  

endv.Character.Torso.CFrame = CFrame.new(Vector3.new(50, 50, 50))


game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
plr.Character.Torso.Anchored=true
end)

I was thinking something like

q = game.Players:GetChildren()) do
if q then
endv.Character.Torso.CFrame = CFrame.new(Vector3.new(50, 50, 50))

wait()
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
plr.Character.Torso.Anchored=true
end)

I also want it to anchor them as soon as they teleport.. help?

2 answers

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Well, you'd need to use the MouseButton1Down or MouseButton1Click event. (2 is also available, but I'm thinking you wanted a left click)

Local Script:

script.Parent.MouseButton1Down:connect(function()
    p = game.Players.LocalPlayer
    p.Character.Torso.CFrame = CFrame.new(Vector3.new(50, 50, 50))
    p.Character.Torso.Anchored = true
    --p.PlayerGui.FNMain.Frame.Visible = false
    --Above is your edit
end)
Ad
Log in to vote
0
Answered by 10 years ago

I'm sorry, totally ignore that first part...I have edited it slightly, but it's still not working.

function Click()
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-0,0,0)
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
plr.Character.Torso.Anchored=true
end)
end
wait()
script.Parent.Parent.CameraMode="LockFirstPerson"
game.StarterGui.FNMain.Frame.Visible = false
script.Parent.MouseButton1Down:connect(Click)




0
You can update your question. It'd help Shawnyg 4330 — 10y

Answer this question