im making a script that just allow me to sit in a Throne, but when i sit in it, i cant get out, if i hold Space i enter in a loop of "jump off the seat and sit again", wt can i do for it? This is my Code:
local allowed = {438845010}
local players = game:GetService("Players")
local seat = script.Parent
seat.Disabled = false
seat.Touched:Connect(function (hit)
if seat.Occupant then return end
local player = players:GetPlayerFromCharacter(hit.Parent)
local character = player.Character
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
for i = 1, #allowed do
if allowed[i] == player.UserId then
if humanoid then
seat:Sit(humanoid)
end
else
humanoid.Health = -10
end
end
end)
i need a local script or i can do it in this server script?
