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

How can i make it so if the player touches a GUI button it's HumanoidRootPart gets referenced?

I have no idea how would i do it HELP ME! thanks!

1 answer

✓ Accepted answer

What I think you're trying to do is get a player's HumanoidRootPart when they click a GUI button. To do this, we can put a LocalScript (this is important) in the button with the following code:

--Get the player
local player = game:GetService("Players").LocalPlayer

--When the button is pressed
script.Parent.Activated:Connect(function()
	local humanoidRootPart = player.Character.HumanoidRootPart
end)

Hope this helps.

2 comments

0

Can it be instead of activated, MouseButton1Click? is it the same?

0

Yes it can be. MouseButton1Click, however, is slowly less commonly being used in favor of Activated, so I suggest you use Activated now before MouseButton1Click gets deprecated.

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