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

Script that shows name of the player when they sit and get up from a certain seat using surface gui?

Asked by 3 years ago

Im confused, i've tried many times and every thing I do fails

1 answer

Log in to vote
0
Answered by 3 years ago

Hi you can check who is sitting by checking the property occupant.

So 1st you want to put a script inside the seat, obviously.

then you can insert this code which uses the property occupant to check who is in the seat:

local Seat =  script.Parent 

Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    if Seat.Occupant ~= nil then
        local character = Seat.Occupant.Parent
        print(character.Name)
    end
end)

Hope this helped!

Any questions? Just ask!

Ad

Answer this question