How do I make my bus line chooser visible when player sits on driver seat and non-visible when you get off the seat?
4 Likes
Put this script on the seat itself, local script:
script.Parent:GetPropretyChangedSignal("Occupant"):Connect(function()
if script.Parent.Occupant then
if script.Parent.Ocuupant == game.Players.LocalPlayer then
game.ReplicatedStorage.YOURGUI:Clone().Parent = game.Players.LocalPlayer.PlayerGui
else
game.Players.LocalPlayer.PlayerGui:FindFirstChild("YOURGUI"):Destroy
end
end
end)
If any problem occurs, know its a misspell, cause I’m on mobile right now
1 Like
Ok, I appreciate this, I’ll try it now.
I should replace “YOURGUI” with my gui name if i understand correctly.
And i should add my gui to replicated storage.
Correct?
2 Likes
Correct. Do everything you said.
Make sure it’s :Destroy()
not :Destroy
Thanks, but is it on local script or server script or module script?
Local script. And I mentioned that every error is just a misspelling, cause I’m on the mobile app. That’s why you got that error.
Didn’t work anyway, it’s a DriverSeat, not a normal seat
1 Like
They were misspellngs. Here try this, if it doesn’t work i may be able to provide further assistance
local driveSeat = script.Parent
driveSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if driveSeat.Occupant then
if driveSeat.Occupant == game.Players.LocalPlayer.Character then
print("There is a player sitting here")
local drivingHUD = game.ReplicatedStorage:WaitForChild("YOURGUI"):Clone()
drivingHUD.Parent = game.Players.LocalPlayer.PlayerGui
else
print("There is no player sitting here")
local drivingHUD = game.Players.LocalPlayer.PlayerGui:FindFirstChild("YOURGUI")
if drivingHUD then
drivingHUD:Destroy()
end
end
end
end)