219672660 is not a valid member of Folder "Workspace.BoatPlots"

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to spawn my boat if the player’s boat isnt already spawned
  2. What is the issue? Include screenshots / videos if possible!
    I have a onserverevent function and im getting the error: 219672660 is not a valid member of Folder “Workspace.BoatPlots” . I have already looked on the dev forum and im just confused why my code wont just run my else function. the point of the code is if the player’s boat is already spawned it will destroy the boat and if its nil it should spawn their boat.
Boat.OnServerEvent:Connect(function(Player, boat, region)
	Player = Player
	
	if boat == "Dinghy" then
		print("should run")
		if boatPlots[tostring(Player.UserId)] then
			print("uh")
			boatPlots[tostring(Player.UserId)]:Destroy()
			BoatPool.Remove(Player, region.."Plots")
		else
			PlotManager.SpawnPlot(Player, "Dinghy", region.."Plots")
			
			task.wait(1)
			
			task.spawn(function()
				local con

				con = RunService.Stepped:Connect(function()
					local children = workspace.BoatPlots:GetChildren()

					for i = 1, #children do
						local child = children[i]

						if not boatTable[child] then
							if (child.BoatPart.Position - child.distancePart.Position).Magnitude >= 100 then
								boatTable[child] = true

								for i, player in pairs(Players:GetPlayers()) do
									if tostring(player.UserId) == child.Name then
										BoatPool.Remove(player, region.."Plots")
										con:Disconnect()
									end
								end
							end
						end
					end
				end)
			end)
		end
	end
	
end)

You need to use FindFirstChild.

local boatPlot = boatPlots:FindFirstChild(tostring(Player.UserId))
if boatPlot then

oh wow that was a simple fix tysm

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