Is there someway to disable the cloning part in the script without breaking it or something?

Please help.

here is the code:


local tool = script.Parent
local remote = tool.Shoot

local players = game:GetService("Players")
local goal = workspace.goal

remote.OnServerEvent:Connect(function(player)	
	if player ~= players:GetPlayerFromCharacter(script.Parent.Parent) then
		return
	end
	
	local ball = script.Parent.Handle:Clone()
	ball.CFrame = script.Parent.Handle.CFrame
	
	local trajectory = 1
	local g = Vector3.new(0, -game.Workspace.Gravity, 0)
	local x0 = ball.CFrame * Vector3.new(0,0,0)
	local v0 = (goal.Position - x0 - 0.5 * g * trajectory * trajectory)/trajectory 
	
	ball.Velocity = v0
	ball.Parent = workspace
	ball.CanCollide = true
end)

2 comments

0

You should probably delete the ball after its been cloned

0

remove :Clone() from line 12 lmao