Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i find a players' humoid by clicking a GUI button?

Hey there, i'm trying to do this script

local part = game.Workspace.TestMenuLocation

script.Parent.MouseButton1Click:Connect(function()
	local human = script.Parent:FindFirstChild("Humanoid")
	human.Parent.HumanoidRootPart.CFrame = part.CFrame or human.Parent.Torso.CFrame == part.CFrame
end)

but i want the "local human = script.Parent:FindFirstChild("Humanoid")" line to find the players' humanoid when clicked a button.

How do i fix this

2 comments

0

Is it a local or server script?

0

server script

1 answer

✓ Accepted answer

Change your script to a localscript. Also there is no HumanoidRootPart inside a Humanoid. But this will work :)

local part = game.Workspace.TestMenuLocation
script.Parent.MouseButton1Click:Connect(function()
    local thing = game.Players.LocalPlayer.Character
    thing.HumanoidRootPart.CFrame = part.CFrame or thing.Parent.Torso.CFrame == part.CFrame
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.