Hey, so I’m pretty stuck on this. I’ve been trying to get it to enable a gui when seated in my rocket. I plan for the gui to be enabled late on in the script. If the Player jumps out of the rocket while the gui is enabled, how can I make it disappear.
Was wondering if someone could kind of explain it aswell as well as help me code the script, otherwise I’m not really learning why and how the script works.
local Seat = script.Parent
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant then
local Player = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
if not Player then return end
Player.PlayerGui.GUI.Enabled = true
end
end)
This is why I recommended the Humanoid.Seated method. Binding to it from the client lets you easily toggle the gui, you just have to check the currentSeatPart to make sure it’s the rocket’s seat.
this is all well and good but its conflicting with my rockets regen script. My rocket starts off by being in replicated first, then gets parented to the workspace. I dont think you can disable then enable a localscript so it says that occupant isnt a valid property.