Teleporting all players into seats

what I’m trying to do here is that I want all the players to be telported into 10 seats even if there are only 3 players they will go in 3 random seats, but this script just does nothing onlt this error

attempt to index boolean with ‘Value’

local debounce = false

game:GetService("ReplicatedStorage"):WaitForChild("Values").StoryValues.TeleportPlayersOnBus:GetPropertyChangedSignal("Value"):Connect(function()
	print("triggered")
	for i,v in pairs(game.Players:GetPlayers()) do
		print("players")
		if v.Character then
			print("Character")
			local character = v.Character
			if character.Humanoid.Sit.Value == false then -- heres the error
				for i,seat in pairs(game.Workspace.HouseMap.SchoolBus.Seats:GetChildren()) do
					if debounce == false then
						if not seat.Occupant then
							seat:Sit(character.Humanoid)
							debounce = true
						end
					end
				end
			end
		end
		debounce = false
	end
end)
1 Like

character.Humanoid.Sit is not a value. It’s a property, so you can’t use .Value as it isn’t a ValueObject.
All you have to do is remove the .Value.

1 Like
local debounce = false

game:GetService("ReplicatedStorage"):WaitForChild("Values").StoryValues.TeleportPlayersOnBus:GetPropertyChangedSignal("Value"):Connect(function()
	print("triggered")
	for i,v in pairs(game.Players:GetPlayers()) do
		print("players")
		if v.Character then
			print("Character")
			local character = v.Character
			if character.Humanoid.Sit == false then -- heres the error
				for i,seat in pairs(game.Workspace.HouseMap.SchoolBus.Seats:GetChildren()) do
					if debounce == false then
						if not seat.Occupant then
							seat:Sit(character.Humanoid)
							debounce = true
						end
					end
				end
			end
		end
		debounce = false
	end
end)

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