Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why script dosen't clone but there's no errors on output?

Hello, devs!

So I was making system that shoots with water and there's an script in it. Water was spawning, but it had no childs.

CODE:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, gunPos, mosPos)
	local part = game.ReplicatedStorage.Part:Clone()
	part.Name = "Water"
	part.Parent = game.Workspace
	part.Position = gunPos
	
	
	local distance = (mosPos - gunPos).magnitude
	local speed = 50
	part.CFrame = CFrame.new(gunPos, mosPos)
	part.Velocity = part.CFrame.lookVector * speed
	
	wait()
	
	local damage = game.ReplicatedStorage.Damage:Clone()
	damage.Parent = part
	damage.Disabled = false
end)

ERRORS:

No errors

DETAILS:

Only local damage part is important in this question

Damage script located in ReplicatedStorage Part (Water) located in ReplicatedStorage

Damage script should be cloned in Water Part that was cloned to workspace, but it dosen't clone

1 answer

There is usually a delay when cloning scripts.

A simple work-around is... Module scripts!

Simply put the function in the Module, and require it!

Another possible reason is that there is an error in the damage script. I cannot say for certain as I don't know the contents.

1 comment

0

The problem is that I know 0% about module scripts...

This discussion is preserved as it was. New answers, comments, and votes are closed.