Is cloning things from ReplicatedStorage into Workspace making this errors?

I am making one minigun and I dont use “Instance.new(Part, game.Workspace)” I am just cloning from the RS(ReplicatedStorage) into the Workspace.

something like this:

Local script

--part of script--
[...]
GunShooting = mouse.Button1Down:Connect(function()
		shooting = true
		while shooting do
			wait(0.15)
			RE:FireServer(tool.ToolsParts.BulletLocation.Position, tool.ToolsParts.BulletLocation.Orientation, mouse.Hit.p)
			gunFire:Play()
			shootingAnimation:Play()
			mouse.Button1Up:Connect(function()
				shooting = false
				shootingAnimation:Stop()
				GunShooting = nil
			end)
		end
	end)
end)

On Server side

local RS = game:GetService("ReplicatedStorage")
local RE = RS.CandyCaneMinigun

RE.OnServerEvent:Connect(function(player, gunPos, gunOr, mosPos)
	local bullet = game.ReplicatedStorage.CandyCane:Clone()
	bullet.Parent = game.Workspace
	bullet.Position = gunPos

	local distance = (mosPos - gunPos).magnitude
	local speed = 350
	bullet.CFrame = CFrame.new(gunPos, mosPos)
	bullet.Velocity = bullet.CFrame.lookVector * speed

	local fly = Instance.new("BodyForce",bullet)
	fly.Force = Vector3.new(0, 0, 0)
	bullet.Orientation = gunOr + Vector3.new(0, -180, 0)	

	local attacker = Instance.new("StringValue")
	attacker.Name = "Attacker"
	attacker.Parent = bullet
	attacker.Value = player.Name
end)

It works fine the problem is I dont know why I get this erros…

how it works:

I will use Raycasting after I am just making some tests

1 Like

Its saying that bullet is nil, can you hook us up with a quick screen shot of your Replicated Storage?

image
I did :Clone() soo the bullet doesnt got delete

Ngl this is pretty weird, I would probably revert to debugging to see whats going on here. Try this:

print(game:GetService("ReplicatedStorage"):GetChildren(), bullet)


this is what happen I never saw this before bc with others scripts I did I used the same way (cloning the bullet from RS into workspace) but the output never said something maybe is bc the cooldown is too fast idk

The problem was with the damage script inside the part I didnt saw that.