Only the client sees the parts and effects When firing to all clients

The problem is in the title.

local script:

--VALUES--
local tool = script.Parent.Parent
local lcl_event_1 = script.Parent.Parent:WaitForChild("Events")["local_1"]
local srv_event_1 = script.Parent.Parent:WaitForChild("Events")["server_1"]
local srv_event_2 = script.Parent.Parent:WaitForChild("Events")["server_2"]

local debounce = false
local deb = false

local animation = script.Parent.Parent.Anims.Barrage


--SETTINGS--
local cooldown = 4
local numberOfPunches = 50


--ACTIVATE--
tool.Activated:Connect(function()
	
	if debounce == false then
		debounce = true
		
		srv_event_1:FireServer()

		task.wait(cooldown)
		debounce = false
	end
	
end)


--CLIENT SIDE--

lcl_event_1.OnClientEvent:Connect(function(plr)
	
	local origin = plr.Character:FindFirstChild("HumanoidRootPart")
	
 	local animation = plr.Character.Humanoid:LoadAnimation(animation)
	animation:Play()

	for i=1,numberOfPunches do
		task.wait(math.random(0.02,0.08))
		
		task.spawn(function()
			local randoPos = origin.CFrame * CFrame.new(math.random(-2,2),math.random(-1,2),math.random(-0.2,0))

			local tweenS = game:GetService("TweenService")
			local ti = TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)

			local prt = Instance.new("Part")
			prt.Size = Vector3.new(1.1,1.1,2.7)
			prt.CanCollide = false
			prt.Anchored = true
			prt.Material = "SmoothPlastic"
			prt.Color =plr.Character["Body Colors"].RightArmColor3
			prt.CFrame = randoPos
			prt.Parent = game.Workspace.FX 
			
			srv_event_2:FireServer(i,numberOfPunches)
					
			--PARTICLES--
			
			local wave = game.ReplicatedStorage["Assets"]["wave"]:Clone()
			wave.Parent = game.Workspace.FX 
			wave.Attachment.Parent = prt			
			wave:Destroy()
			
			prt.Attachment.smokering:Emit(prt.Attachment.smokering:GetAttribute("EmitCount"))
			
			tweenS:Create(prt,ti,{CFrame = prt.CFrame * CFrame.new(0,0,math.random(-8,-5))}):Play() 
			
			task.wait(0.05)

			prt.Attachment["9"]:Emit(prt.Attachment["9"]:GetAttribute("EmitCount"))
			
			tweenS:Create(prt,TweenInfo.new(0.04,Enum.EasingStyle.Sine),{Transparency = 1}):Play()
			task.wait(0.4)

			prt:Destroy()

		end)
	end

	animation:Stop()
end)

server script:

local Debris = game:GetService("Debris")
local tool = script.Parent.Parent

local lcl_event_1 = script.Parent.Parent:WaitForChild("Events")["local_1"]
local srv_event_1 = script.Parent.Parent:WaitForChild("Events")["server_1"]
local srv_event_2 = script.Parent.Parent:WaitForChild("Events")["server_2"]

srv_event_1.OnServerEvent:Connect(function(plr)
	lcl_event_1:FireAllClients(plr)
end)

--SETTINGS--
local Range = 7
local Damage = .5
local EndDamage = 5
local Knockback = 200


--Damage--

srv_event_2.OnServerEvent:Connect(function(plr,i,numberOfPunches)
	
	local PunchSound = script.Parent.Parent.Sounds:WaitForChild("Punch"):Clone()
	PunchSound.Parent = plr.Character:FindFirstChild("HumanoidRootPart")
	PunchSound:Play()
	Debris:AddItem(PunchSound, 1)
	
	local tweenI = TweenInfo.new(
		0.05,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out
	)
	
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {plr.Character}
	raycastParams.FilterType = Enum.RaycastFilterType.Exclude
	
	local raycastResult = workspace:Raycast(plr.Character["HumanoidRootPart"].CFrame.Position, plr.Character["HumanoidRootPart"].CFrame.LookVector * Range)
	
	if raycastResult then
		if raycastResult.Instance.Parent:FindFirstChild("Humanoid") and raycastResult.Instance.Parent ~= plr.Character  then
			if i == numberOfPunches then				
				local enemy = raycastResult.Instance.Parent		
				enemy:FindFirstChild("Humanoid"):TakeDamage(EndDamage)
				enemy.PrimaryPart.Velocity = plr.Character.HumanoidRootPart.CFrame.LookVector * Knockback			
				enemy.PrimaryPart.CFrame = CFrame.lookAt(enemy.PrimaryPart.Position, plr.Character:FindFirstChild("HumanoidRootPart").Position)
				
				local Shakes = script.ShakeScript:Clone()
				Shakes.Parent =  plr.Character
				Shakes.Disabled = false
				Debris:AddItem(Shakes,.55)
				
				local Shakes2 = script.ShakeScript:Clone()
				Shakes2.Parent =  enemy
				Shakes2.Disabled = false
				Debris:AddItem(Shakes2,.55)
				
				local HitSound = script.Parent.Parent.Sounds:WaitForChild("Knockback"):Clone()
				HitSound.Parent = enemy:FindFirstChild("HumanoidRootPart")
				HitSound:Play()
				Debris:AddItem(HitSound, 1)
				
				local highlight = Instance.new("Highlight")
				highlight.Parent = enemy
				highlight.Name = "BarrageHighlight"
				highlight.DepthMode = Enum.HighlightDepthMode.Occluded
				highlight.FillTransparency = 0
				highlight.OutlineTransparency = 1
				local HighlightTween1 = game:GetService("TweenService"):Create(highlight, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false), {FillTransparency = 1}):Play()
				Debris:AddItem(highlight, 1)
				Debris:AddItem(HighlightTween1, 1)
				
			elseif i ~= numberOfPunches then
				local enemy = raycastResult.Instance.Parent
				enemy:FindFirstChild("Humanoid"):TakeDamage(Damage)
				
				if enemy:FindFirstChild("BarrageHighlight") then

				else
					local highlight = Instance.new("Highlight")
					highlight.Parent = enemy
					highlight.Name = "BarrageHighlight"
					highlight.DepthMode = Enum.HighlightDepthMode.Occluded
					highlight.FillTransparency = 0
					highlight.OutlineTransparency = 1
					local HighlightTween1 = game:GetService("TweenService"):Create(highlight, TweenInfo.new(.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false), {FillTransparency = 1}):Play()
					Debris:AddItem(highlight, .2)
					Debris:AddItem(HighlightTween1, .2)
				end
				
				local HitSound = script.Parent.Parent.Sounds:WaitForChild("Hit"):Clone()
				HitSound.Parent = enemy:FindFirstChild("HumanoidRootPart")
				HitSound:Play()
				Debris:AddItem(HitSound, 1)
				
			end
		end
	else
	end
	
	
end)

Workspace/ReplicatedStorage:
Screenshot 2023-07-30 141814
StarterPack:
Screenshot 2023-07-30 141807

Video:

Maybe someone can help me thanks.

2 Likes

btw this topic is still not solved

1 Like