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

I am trying to use a touched event to make the character sit, but it doesn't work?

This is in a localscript inside a part. not a seat part, just a normal part.

local seat = script.Parent


seat.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	
	humanoid.HumanoidStateType = Enum.HumanoidStateType.Seated
	
end)

1 comment

0

what are you using this for

1 answer

"local script" you cant use the touched effect in local script try a normal one also heres a little edit of this code (should prevent errors if the thing that touches it doesnt have humanoid)

local seat = script.Parent


seat.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	humanoid.HumanoidStateType = Enum.HumanoidStateType.Seated
	end
end)

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