Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with seated event?

I was trying to get something to happen when a player sits in a seat this is what i have,

game.Workspace.Table.Red.Touched:connect(function(touched)
	if touched.Parent.Humanoid.Seated == true then		
	print("Red Get off Bruh")
	else
		wait() return
	end
end)

it does not seem to do anything

2 answers

✓ Accepted answer
game.Workspace.Table.Red.Touched:connect(function(touched)
    if touched.Parent.Humanoid.Sit == true then      -- the only problem I see is with seated == sit.
    print("Red Get off Bruh")
    else
        wait() return
    end
end)

2 comments

0

XD how did i make that mistake Thanks a lot

0

maybe you confused it with english. "im sit in my car" does not make sense. you could also make a bool value that is called seated. also, wheres the place you have that script in?

Touching is not exactly Seating, so I recommend to use DescendantAdded. I'll explain:

When your character seats, a Weld is created between his torso and the seat, and it's called "SeatWeld", so all you gotta do to detect it is check when a descendant of the seat called SeatWeld is added. It is more practical than checking the Humanoid.

game.Workspace.Table.Red.DescendantAdded:connect(function(descendant)
    if descendant.Name == "SeatWeld" then      
    print("Red Get off Bruh")
    else
        wait() return
    end
end)

3 comments

0

The other answer is correct, but this is more precise.

0

Makes sense i will save this for later use

0

I always used ChildRemoved, but I think it's deprecated now.

This discussion is preserved as it was. New answers, comments, and votes are closed.