I edited a script from the developer forum and I want it to show a GUI when the player sits down and it disappears when the player gets up, and the script isn't working.
local Players = game:GetService("Players")
local seat = script.Parent
local currentPlayer = nil
seat:GetPropertyChangedSignal("Occupant"):Connect(function() local humanoid = seat.Occupant if humanoid then local character = humanoid.Parent local player = Players:GetPlayerFromCharacter(character) if player then game.StarterGui.ComputerGUI.Frame.Visible = true currentPlayer = player return end end if currentPlayer then game.StarterGui.ComputerGUI.Frame.Visible = false currentPlayer = nil end end)
local Players = game:GetService("Players")
local seat = Instance.new("Seat")
seat.Anchored = true
seat.Position = Vector3.new(-111.57, 6.845, 3.845)
seat.Size = Vector3.new(1.98, 0.23, 1.93)
seat.Material = Enum.Material.Wood
seat.BrickColor = BrickColor.new("Dark orange")
seat.TopSurface = "Smooth"
seat.BottomSurface = "Smooth"
seat.Parent = workspace
local currentPlayer = nil
**seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local humanoid = seat.Occupant
if humanoid then
local character = humanoid.Parent
local player = Players:GetPlayerFromCharacter(character)
if player then
game.StarterGui.ComputerGUI.Frame.Visible = true
currentPlayer = player
return
end
end
if currentPlayer then
game.StarterGui.ComputerGUI.Frame.Visible = false
currentPlayer = nil
end
end)**

1 comment
Please fix your code blocks.