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

6 comments
Doing stuff like that with humanoids causes funky behaviour, at least from my experience, might wanna make the sitting server side
Thanks! I'll need to look more into this than I thought
When a player sits a weld is created you can check with an event for when this weld is removed to show the frame again
You might need to call Sit on the server side
Thank you, i'll try my best
Also, there is a property of the humanoid called seatpart