750 robux to fix Ship spawning tool

Hello. I am looking for someone to fix my ship spawning tool, I want it to, when clicked, only spawn a ship on smooth terrain water. Right now it spawns a ship anywhere you click.

Server

local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Modules = ReplicatedStorage.Modules

local ShipHandlerMod = require(Modules.Main.Ships)

	
local Tool = script.Parent

local Player = game:GetService("Players"):WaitForChild(Tool.Parent.Parent.Name)

function insert()
	local root = game.ServerStorage.Ships:FindFirstChild(Tool.Name)
	local rat=root:clone()
	rat.Parent=game.workspace
	
	ShipHandlerMod:SetShip(Player,rat)
	

	local instances = rat:GetChildren()
	if #instances == 0 then 
		rat:Destroy()	return
	end
	
	local t = Tool.Parent.PrimaryPart
	local headLoc = game.Workspace.Terrain:WorldToCell(script.Parent.Position)
	local hasAnyWater = game.Workspace.Terrain:GetWaterCell(headLoc.x, headLoc.y, headLoc.z)
	

	--rat.Torso.Anchored=false
	
	rat.HumanoidRootPart.Anchored = false
if hasAnyWater==true then
		wait(1)
		
		rat:MoveTo(t.Position + t.CFrame.lookVector * 10)	
		print("no water :(")
	
	Tool:Destroy()
end
end
local enabled= true
function onActivated()
	if not enabled then
		return
	end

	enabled = false

--wait(1)
Tool.Handle.TextNotify.Text.Text="Spawning Ship)"
	insert()

end
Tool.Activated:Connect(onActivated)

My tag is CheetahSpeed#2472

1 Like

This topic was automatically closed after 0 minutes. New replies are no longer allowed.