I keep getting a Index Nil with Parent error with my boat cloning script how do I fix this?
I am making a pirate game but I have an error with my ship cloning script you have to press a button to spawn the ships but it does not work I have my ships located in Server storage and keep getting an error like this: Workspace.Regen.Spawn script:7: attempt to index nil with 'Parent' I have no idea why and it says this it also happens with every other script I try pls help:
local Clicker = script.Parent
local Object = game.ServerStorage:WaitForChild("smallship")
local ObjectSpawn = game.Workspace:WaitForChild("Regen")
script.Parent.ClickDetector.MouseClick:Connect(function()
local CloneObject = Object:Clone()
CloneObject.Parent = game.Workspace
CloneObject.CFrame.position(161, 2.5, -91)
end)