Working on a projectile system. The problem is that sometimes projectiles will have special effect that run on a localscript(the script named "p"). However for some reason the "p" script never runs

Heres the script that clones the "p" script

local bucket=game:GetService("Debris")
game.ReplicatedStorage.Remotes.ProcessProjectile.OnClientEvent:connect(function(player,object,duration,velocity,cframe)
	local newprojectile=object:clone()
	newprojectile.BodyVelocity.MaxForce=Vector3.new(math.huge,math.huge,math.huge)
	newprojectile.BodyVelocity.Velocity=velocity
	newprojectile.CFrame=cframe
	local pfx=newprojectile:FindFirstChild("p")
	if pfx~=nil then
		pfx.follow.Value=newprojectile
		pfx.Parent=player.Character
		bucket:AddItem(pfx,duration)
	end
	newprojectile.Parent=game.Workspace
	bucket:AddItem(newprojectile,duration)
end)

and although I don't think this'll be useful heres the p script

print("am I working?")

2 comments

0

Is the local script disabled? Because if it's not, then it would run before it's even cloned. And if it is, make sure to make disabled false.

0

The localscript is in replicatedstorage so it wont run even if disabled is false. And no disabled is not on