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 get the humanoid In the gui?

I was looking to get the humanoid located in a text button with a local script but It wasn't working.

local player = game.Players.LocalPlayer
local character
	repeat
		character = player.Character
	wait()
	until character
local hum = character:WaitForChild("Humanoid")

script.Parent.MouseButton1Down:Connect(function()
	hum.Position = Vector3.new(50, 50, 50)
end)

1 answer

✓ Accepted answer

This should solve your problem Also, humanoid cannot be moved, use character.HumanoidRootPart

local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then -- a check
    character = player.CharacterAdded:wait()
end
local hum = character:WaitForChild("Humanoid")

script.Parent.MouseButton1Down:Connect(function()
   character:WaitForChild("HumanoidRootPart").Position = Vector3.new(50, 50, 50)
end)

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