Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with seated event?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago
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)

0
XD how did i make that mistake Thanks a lot raspyjessie 117 — 9y
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? TroytheDestroyer 75 — 9y
Ad
Log in to vote
2
Answered by
Tesouro 407 Moderation Voter
9 years ago

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)
0
The other answer is correct, but this is more precise. Tesouro 407 — 9y
0
Makes sense i will save this for later use raspyjessie 117 — 9y
0
I always used ChildRemoved, but I think it's deprecated now. Tesouro 407 — 9y

Answer this question