Can anyone assist me if they can? I made a GUI eject button for when i enter the bus i teleport and sit on a seat, once i'm seated i then made it so that an eject button GUI pops up and i can eject, but if one person goes and sits in the bus and makes the GUI appear, it also appear for everyone else in the server and they can use it as well, I would like to know how to make it so that the GUI only appears for the player that gets seated. Also, Once i click the eject button the player teleports with the seat attach and is seated, i tried to make the player jump when it teleport but i dont know how to execute it. By the way, this is all in a local script in StarterGUI
**local db = true
local player = game.Players.LocalPlayer
local target = game.Workspace.EjectPlace
--THIS IS SEAT 1
workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat2.ChildAdded:connect(function()
player = game.Players:GetPlayerFromCharacter(workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat1.Occupant.Parent)
script.Parent.Visible = true
end)
script.Parent.MouseButton1Click:Connect(function()
if db == true then
db = false
player2.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(-16, 3.5, 90.505)
game.Players.LocalPlayer.Character.Humanoid.Jumping = true
script.Parent.Visible = false
db = true
end
end)
--THIS IS SEAT 2
workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat2.ChildAdded:connect(function()
player2 = game.Players:GetPlayerFromCharacter(workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat2.Occupant.Parent)
script.Parent.Visible = true
end)
script.Parent.MouseButton1Click:Connect(function()
if db == true then
db = false
player2.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(-16, 3.5, 90.505)
game.Players.LocalPlayer.Character.Humanoid.Jumping = true
script.Parent.Visible = false
db = true end end) --THIS IS SEAT 3 workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat3.ChildAdded:connect(function() player3 = game.Players:GetPlayerFromCharacter(workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat3.Occupant.Parent)
script.Parent.Visible = true
end) script.Parent.MouseButton1Click:Connect(function() if db == true then db = false
player3.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(-16, 3.5, 90.505) game.Players.LocalPlayer.Character.Humanoid.Jumping = true script.Parent.Visible = false
db = true end end) --THIS IS SEAT 4 workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat4.ChildAdded:connect(function() player4 = game.Players:GetPlayerFromCharacter(workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat4.Occupant.Parent)
script.Parent.Visible = true
end) script.Parent.MouseButton1Click:Connect(function() if db == true then db = false
player4.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(-16, 3.5, 90.505) game.Players.LocalPlayer.Character.Humanoid.Jumping = true script.Parent.Visible = false
db = true end end) --THIS IS SEAT 5 workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat5.ChildAdded:connect(function() player5 = game.Players:GetPlayerFromCharacter(workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat5.Occupant.Parent)
script.Parent.Visible = true
end) script.Parent.MouseButton1Click:Connect(function() if db == true then db = false player5.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(-16, 3.5, 90.505) game.Players.LocalPlayer.Character.Humanoid.Jumping = true script.Parent.Visible = false
db = true end end) --THIS IS SEAT 6 workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat6.ChildAdded:connect(function() player6 = game.Players:GetPlayerFromCharacter(workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat6.Occupant.Parent)
script.Parent.Visible = true
end) script.Parent.MouseButton1Click:Connect(function() if db == true then db = false
player6.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(-16, 3.5, 90.505) game.Players.LocalPlayer.Character.Humanoid.Jumping = true script.Parent.Visible = false
db = true end end)**
So, GUI is always client sided unless you have some sort of server based gui.
If you wanted to trigger the gui you could do
hasSat = false seat.Touched:Connect(function() if seat.Occupant == nil and not hasSat then hasSat = true screenGUI.Enabled = true end end) seat.TouchEnded:Connect(function() if hasSat and seat.Occupant ~= nil then hasSat = false screenGUI.Enabled = false end end)
This would be in a local script. (This is just a concept not the exact solution)
You can use this basic script to do it, since its local, you don't have to get the players sitting on a certain seat but instead it will detect if the Local Player is sitting on that certain seat.
local seat = workspace.Chair.Seat -- Change to your seat local player = game.Players.LocalPlayer local gui = player.PlayerGui:WaitForChild("ScreenGui").EjectButton gui.MouseButton1Click:Connect(function() player.Character.Humanoid.Sit = false end) while wait() do -- Change to whatever function you want if seat.Occupant == player.Character.Humanoid then gui.Visible = true else if seat.Occupant == nil then gui.Visible = false end end end -- end for while loop!
Hope it helps you!