Hello all! So, I've been frustrated with my script, since it didn't properly function. The script below is supposed to make the person jump if they aren't in the group. It works the first time, but after that, they never jump again. I've tested it in studio, setting up prints, and the code runs all the way through. Is there reason I can't perform the jump more than once? Thanks for any help!

Script:

GroupID = 2549890

function onSit(player, character)
	if not player then return end
	if not player:IsInGroup(GroupID) then
		player.Character.Humanoid.Jump = true
		wait(.1)
	end
end

function onGetUp(player, character)
	if not player then return end
end

script.Parent.ChildAdded:connect(function (c)
	if c:IsA("Weld") and c.Name == "SeatWeld" then
		local char = c.Part1.Parent
		sitter = char
		onSit(game.Players:GetPlayerFromCharacter(char), char)
	end
end)
script.Parent.ChildRemoved:connect(function (c)
	print('55')
	if c:IsA("Weld") and c.Name == "SeatWeld" then
		local char = c.Part1.Parent
		sitter = nil
		onGetUp(game.Players:GetPlayerFromCharacter(char), char)
	end
end)

1 comment

0

Try and comment out lines 11-13, 22-29, and 18. I do not understand the point of having a .ChildRemoved function. & on line 6, you could shorten the line with the "character" argument.