i made a seat script that only allow me to sit in it, but when i sit i cant get out, wt can i do for just get out with "space" for example?
local allowed = {438845010} local players = game:GetService("Players") local seat = script.Parent seat.Disabled = true seat.Touched:Connect(function (hit) if seat.Occupant then return end local player = players:GetPlayerFromCharacter(hit.Parent) for i = 1, #allowed do if allowed[i] == player.UserId then local humanoid = player.Character:FindFirstChildWhichIsA("Humanoid") if humanoid then seat:Sit(humanoid) end break end end end)
You should add simple scripts in this situation your script is too complicated and has more chances to error instead what you can do is:
local Owner = "Ariirael" script.Parent.ChildAdded:Connect(function(PartAdded) if PartAdded.Name == "SeatWeld" then local Name = PartAdded.Part1.Parent.Name if Name == Owner then print(Name.." the owner is sitting") else wait() local Player = PartAdded.Part1.Parent Player:FindFirstChild("Humanoid").Sit = false print(Player.Name.." was prevented from sitting") end end end)
I Hope This Helps!