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

[Solved] How would I fix this teleport player gui??

Asked by 5 years ago
Edited 5 years ago
place = CFrame.new(1,1,1)
script.Parent.MouseButton1Down:connect(function()
local humanoid = game.Players.LocalPlayer:FindFirstChild("Humanoid")
if (humanoid ~= nil) then 
    humanoid.Torso.CFrame = place 
    end
    end)

When you click the parent it teleports the player who clicked anybody know?? [The script above doesn't work]

2 answers

Log in to vote
0
Answered by 5 years ago

Instead of

local humanoid = game.Players.LocalPlayer:FindFirstChild("Humanoid")
if (humanoid ~= nil) then
       humanoid.Torso.CFrame = place
    end
end)

type:

local char = gme.Players.LocalPlayer.Character
if char then
    char.HumanoidRootPart.CFrame = place
end
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You can't get the torso from the humanoid, but you can get it through the character like this:

R6:

place = CFrame.new(1,1,1)
script.Parent.MouseButton1Down:connect(function()
    local player = game.Players.LocalPlayer
    local char = player.CharacterAdded:wait()

    if (char~= nil) then
        char.Torso.CFrame = place 
    end
end)

R15:

place = CFrame.new(1,1,1)
script.Parent.MouseButton1Down:connect(function()
    local player = game.Players.LocalPlayer
    local char = player.CharacterAdded:wait()

    if (char~= nil) then
        char.LowerTorso.CFrame = place 
    end
end)
0
Thanks but I tried it and.. It din't work for some reason killerbrasko2002 33 — 5y
0
Errors? Trollapse 89 — 5y
0
Use the proper script for your game type Trollapse 89 — 5y

Answer this question