My script only works in Studio test mode, what's the issue here?
I have been working on a script for a friend. He wants a chair that restricts jumping so that people can't jump off a horse once they get on. I have been working on this script for a while now and I thought it was working, but he told me it wasn't working. Later on down the road I realized it wasn't working in game, but it worked in Studio test mode. I have looked up this issue for a long time now and I can't seem to get it to work in game at all. Any help or suggestions are greatly appreciated, or maybe other ways I could write this script?
02 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil and game.Players:playerFromCharacter(hit.Parent) then |
03 | if hit.Parent.Humanoid.Health = = 0 then return end |
05 | local plr = game.Players:playerFromCharacter(hit.Parent) |
06 | repeat wait() until plr.Character |
07 | local chr = plr.Character |
08 | chr:WaitForChild( "Humanoid" ).Changed:connect( function () |
09 | chr.Humanoid.Jump = false |
18 | script.Parent.Touched:connect(chaining) |
EDIT: Yes, I have tried running this as both a localscript and a regular script, and to no avail. I will try to change the name of the SeatWeld, thanks for the tip. That might be a LOT easier...
RE-EDIT: I made a script that changed the name of SeatWeld whenever it is created, however when attached to the horse it glitched the horse so it doesn't work for the purpose. If anyone has any other scripts that would restrict jumping in a seat, please post them. Or if they can find an issue with my script...