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

How to access player parts?

How would I access player parts? For example, if I wanted to destroy the player's hand when the player steps on a brick. The script below

local debounce = false
local brick = script.Parent

brick.Touched:Connect(function(activate)
	if not debounce then
		debounce = true
		local humanoid = activate.Parent:FindFirstChild("Humanoid")
		if humanoid then
			local player = game.Players:FindFirstChild(activate.Parent.Name)
			player.RightHand.Disabled = true
		end
	end
end)

isn't working. There isn't any output either. Please help.

1 answer

✓ Accepted answer

try this

local debounce = false
local brick = script.Parent

brick.Touched:Connect(function(hit)
	if debounce == false then
		debounce = true
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if humanoid then
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.Character.RightHand.Disabled = true --i hope you defined righthand correctly
		end
	end
end)

if RightHand is in fact a part or an union, you cant disable it, if you want it gone do

player.Character.RightHand:Destroy()

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