I'm very new to this forum and to lua scripting, i need help, this code is in a local script but it appears for everyone...
This code is for when the player sits, appear a GUI for local player, but it's appearing for all players, can someone explain me, I'm NOT requesting a new script
Code:
01 | local seat = workspace.OfficeChair 1. Seat |
02 | local ui = script.Parent |
03 |
04 | while true do |
05 | wait( 1 ) |
06 | if seat.Occupant = = nil then |
07 | ui.Visible = false |
08 | else |
09 | ui.Visible = true |
10 | end |
11 | end |
make the code check to make sure the occupants name is the same as the game.Players.LocalPlayer 's name. that should fix it.
I'll just supplement 129Steve129's response with the following code:
01 | local seat = workspace.OfficeChair 1. Seat |
02 | local ui = script.Parent |
03 | local player = game.Players.LocalPlayer |
04 |
05 | while true do |
06 | wait( 1 ) |
07 | if seat.Occupant = = nil or seat.Occupant.Parent.Name ~ = player.Name then |
08 | ui.Visible = false |
09 | else |
10 | ui.Visible = true |
11 | end |
12 | end |