Simple Scripts - Could someone please fix?
02 | function onTouched(hit) |
03 | if not enabled then return end |
05 | local h = hit.Parent:findFirstChild( "Humanoid" ) |
14 | script.Parent.Touched:connect(onTouched) |
I wanted the first script to sit a person when they touch it, and if anything other than a humanoid touches it, it will only print and not run the function.
So let's say a player drops a hat onto the brick, the script will then break - but I have no idea how to do that :/
-- There might be a problem with my debouncing and use of else with it.
02 | function onTouched(hit) |
03 | if not enabled then return end |
05 | local h = hit.Parent:findFirstChild( "Humanoid" ) |
06 | if h.Sit = = false then |
14 | script.Parent.Touched:connect(onTouched) |
The second script is meant to kill any player touching it if they're not sitted. So if anything other than a humanoid, or a dead humanoid touches it, it will not break and only print.
-- There might be a problem with my debouncing and use of else with it.
Could someone fix both for me? I'm not a great scripter and can't seem to figure out the problem with these scripts :/