So I am creating a simple system to make the humanoid sit when clicking a part. Here is my code:
local model = script.Parent
local seatObject = model.Seat
local clickDetector = model.ClickDetector
clickDetector.MouseClick:connect(function(plr)
seatObject:Sit(plr.Character.Humanoid)
end)
I have tried almost everything. Am I making a simple mistake?
If a player joins, he or she will be classified as players. So the function you are using searches for Humanoid in Players. It’s not there. You have to find the player in workspace to find Humanoid. Try this script.
game.Players.PlayerAdded:Connect(function(plr)
wait(5)
if game.Workspace:FindFirstChild(plr.Name) then
script.Parent:Sit(game.Workspace[plr.Name].Humanoid)
end
end)