Get Players from Seats

Hello I want to make a button that when clicked, it makes seated players stand up, I tried the following script but it doesn’t go, the game gives to me error cause it try to get nill with parent inside the brakets, can anyone help me ?

for i,v in ipairs(Plot1:GetDescendants()) do
			if v:IsA("Seat") then
				if v.Occupant then
					local player = game.Players:GetPlayerFromCharacter(v.Occupant.Parent)
					if player then
						player.Character:FindFirstChild("Humanoid").Sit = false 

					end
				end
			end
		end

the Occupant is the Humanoid of the Player which makes the GetPlayerFromCharacter function here useless

So all you need to do is:

for i,v in ipairs(Plot1:GetDescendants()) do
	if v:IsA("Seat") then
		if v.Occupant then
           v.Occupant.Jump = true -- causes the Player to jump out of the seat
	    end
    end
end


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.