I'm getting quite a headache from this. So the script that I've created detects if a player is close to a seat, so that when E is pressed, they sit on it. I've also created a billboard and a textbutton within it which displays the prompt "E".
So far, everything is working fine. The TextButton disappears when I sit down which is what I wanted, but when I leave the seat, the TextButton dosen't come back. So far, I haven't come up with any solutions to the problem, so thats why i'm here to ask you guys for help. Does anyone know any methods I could use to solve this problem?
What i'm trying to also figure out is how would I make it so that if I press E again, it will leave the seat without pressing space?
local Gui = game.Workspace.ChairMesh.BillboardPart:WaitForChild("EToInteract") local frame = Gui:FindFirstChild("TextButton") local player = game.Players.LocalPlayer local seat = game.Workspace.ChairMesh.Chair game:GetService("UserInputService").InputBegan:connect(function(input) if (player.Character and player:DistanceFromCharacter(seat.Position) < 5) and input.KeyCode == Enum.KeyCode.E then seat:Sit(player.Character.Humanoid) frame.Visible = false end end)
Again, thanks for the support laddies