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?
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)
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)