Hello!
I am currently making a Vibe Game with my friends, and it's a project that we have been working on for a while now. We are now getting onto making animated seats, which play an animation upon sitting. Now, in our game we have this Teleport GUI that teleports you to a place upon clicking the button, there is a list of places. Now, when you sit on the seat, if you were to teleport somewhere it would take the seat with you and break it.
That being said, I tried to make a script where it would disable the TeleportGUI, named "Teleports" in our case, upon sitting. That did work, however, the problem comes that when you leave the seat it doesn't re-enable the GUI. To make the seat work I have a ServerScript and 2 Animations named SeatingR15 and SeatingR6.
Here is the script inside the seat
local Seat = script.Parent
local SeatR15 = Seat.SeatingR15
local SeatR6 = Seat.SeatingR6
local SeatingAnimation
Seat.Changed:Connect(function(property)
if property ~= ("Occupant") then return end
local Seater = Seat.Occupant
if Seater then
local Character = Seater.Parent
local Humanoid = Character.Humanoid
local Player = game.Players:GetPlayerFromCharacter(Character)
if Player and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Player.PlayerGui:WaitForChild("Teleports").Enabled = false
SeatingAnimation = Humanoid:LoadAnimation(SeatR15)
SeatingAnimation:Play()
elseif Player then
SeatingAnimation = Humanoid:LoadAnimation(SeatR6)
SeatingAnimation:Play()
end
elseif SeatingAnimation then
SeatingAnimation:Stop()
end
end)
As you may see in the script upon sitting it tells the TeleportGUI to disable upon sitting, however I do not know how to apply the same for the last line which runs once the player leaves the seat.
If I could get some help with this, it would be great!
Thanks!
