Hello, I'm adding a slide in a game I'm creating, and so that the players slide, I'm adding a sit script. I've been having trouble creating a working script - can anyone help? Thank you!
Having trouble creating sit script for a slide?
3 answers
Its quite simple! Thanks to the Humanoid, you can make everyone who touches a part sit!
Carefully, read.
part = script.Parent -- THIS, is the location of the part, which trying to find the part that activates the function.
part.Touched:Connect(function(hit) -- The function! it detects if the part is touched!
if hit.Parent:FindFirstChild("Humanoid") then -- Detects if there is a humanoid!
hit.Parent.Humanoid.Sit = true -- Activates an option inside humanoid!
else
return
end
end)
Thanks for reading!
Have a nice day!
-- One more thing, at the first line, make sure to give CORRECT locations, and try to create an Invisible Part with CanCollide off at the place you want the player to sit.
(Sorry if it doesn't works, didn't check on Studio)
--- Special Note To Down Voters : Please comment your Reason, And do not hide. ---
2 comments
Thank you very much! I'll test it on studio right now and let you know! :)
No problem!
Inside the Humanoid, there is a property called Sit which can be toggled to make the associated Character sit.
What you should likely do, is at the top of the slide have a Part that when Touched:
- checks if what
Touchedit is associated with aPlayer - get their
Character'sHumanoid - set the
Humanoid'sSitproperty totrue
Although it's already been answered, I'll leave my answer here just as a 'masterclass' about this.
Inside Humanoids there is a sit property which lets you easily make any Humanoid sit.
The script works a little something like this. Read carefully as I added comments to make sure you get what's happening! :)
part = script.Parent -- this identifies the parent of the script aka the block we are using to make someone sit. You can change this to any part, for example game.Workspace.Baseplate to make the baseplate the part
part.Touched:Connect(function(hit) -- this is the function that tells us when the part is touched
print 'initialized' -- this is purely something I like to do for debugging, it tells us that the function has started by printing to the console
if hit.Parent:FindFirstChild("Humanoid") then -- this makes sure the object hitting it was a humanoid, or else it would fire for anything
hit.Parent.Humanoid.Sit = true -- makes our user sit
else
print 'ended'
end
end)
There we have it, I hope this helped you out! :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You have a valkyrie and you’re this immature...I'd expect more from a trader like you.