Ad
Log in to vote
0

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

Asked by 3 days ago

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

0
Is it a local or server script? sean12345678900000 15 — 3d
0
server script OreyTheOre 12 — 3d

1 answer

Log in to vote
0
Answered by
Punctist 105
3 days ago

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

Answer this question