I want to make a seat exclusively for one player, if another player sits on it then they are forced to stand up (basically they can't sit down).
This is my script:
local seat = script.Parent seat.ChildAdded:connect(function( newChild ) if newChild:IsA("Weld") then if newChild.Part1.Name == "HumanoidRootPart" then local player = game.Players:GetPlayerFromCharacter(newChild.Part1.Parent) if (player) then if not player.Name == "iiPizzaCraver" then player.Humanoid.Jump = true else --let them sit end end end end end)
There are no errors in the output. It just doesn't work at all.
had to test this myself in studio, but this should work.
local Players = game:GetService('Players') local Seat = script.Parent Seat.Changed:Connect(function() if Seat.Occupant ~= nil then --Seat.Occupant is the Humanoid local name = Seat.Occupant.Parent.Name if Players:FindFirstChild(name) then --if the name is NOT "iiPizzaCraver", then kick them off -- "~=" means not equal to if name ~= 'iiPizzaCraver' then repeat wait() Seat.Occupant.Sit = false until Seat.Occupant.Sit == false end end end end)