Hello Im Very New To Coding And i Have No Idea How To Make a Player Slip/Fall After Touching a Part
i Would Really Appreciate It If Someone Could Tell Me,
Thanks.
Put this in a ServerScript under the part you want the Player to touch.
script.Parent.Touched:connect(function(obj)
if obj.Parent:FindFirstChild("Humanoid") then
obj.Parent.Humanoid.Sit = true
end
end)
This is really not good for you to ask such a question on devforum. Take scripting lessons or just watch some tutorials.
Literally the first few things they teach is Touched events in Lua. But I’ll help you anyways.
You would connect a touched event to a part, but first you must identify the part.
local part = game.Workspace.Part -- accessing the part in the workspace using the hierarchy.
function slipPlayer(character)
character.Humanoid.Sit = true -- set "Sit" to true.
end
part.Touched:Connect(function(hit) -- using an anonymous function, we can make the player sit.
if hit.Parent.Humanoid then
slipPlayer(hit.Parent)
end
end)
the hit argument is going to be one of the player’s character’s body parts, so we have to use the hierarchy to find the original character using this syntax: “hit.Parent”.
Next we will locate the humanoid in the Character, and if it exists (confirming that the touched part is a character) slip the player by using the slipPlayer() function giving it the character to slip.
Hopefully I did this right, as i’m rusty
Here is the simplest way possible!
local TripPart = script.Parent --The place where the part is
TripPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Sit = true
end
end)
Im Sorry For Taking Your Time.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.