Client and server results are different

I have a projectile script that currently gathers an energy ball above the player and fires it to a desired direction. Once the projectile hits, it has to stop and generate some effects around (shockwaves, etc.). The energy ball has a part in the center that is welded to the energy ball itself. The problem is when I fire the projectile and hits the ground, in the client the effects that are supposed to be around the ball are shown further away from the ball, and in the server the effects are shown correctly around the ball.
Any help would be appreciated !! :smiley:

Client:
https://gyazo.com/5e2329aecf607ffee0599fd21ec398bd

Server:
https://gyazo.com/0a1e59aa47ba5ef36c7497364d884156

Script:

local rs = game:GetService("ReplicatedStorage")
local ts = game:GetService("TweenService")
local revent = rs:WaitForChild("Genki")
local fireready = false
local animationstatuswanted = nil
local animationnum = nil
local animationfinishedreceived = nil
local alreadycrashed = nil

revent.OnServerEvent:Connect(function(plr, mouse, active, animationfinished)
	local Humanoid = plr.Character.Humanoid
	local Character = plr.Character
	if Humanoid.Health > 0 then 
		if mouse ~= nil and active ~= nil then
			print("numb1 works")
			if active == false then
				
				-- Principal Vars --
				local genkiFolder = Instance.new("Folder", workspace)
				genkiFolder.Name = plr.Name.."Genki"
				local genkiOut = script.GenkiOut:Clone()
				genkiOut.Parent = genkiFolder

				local genkiIn = genkiOut.Genki
				local glowParticle = genkiOut.Attachment.Glow
				local recollectParticle = genkiIn.Recollect
				local chargetrack = Humanoid:LoadAnimation(genkicharge)
				local chargetrackloop = Humanoid:LoadAnimation(genkichargeloop)
				local righthand = Character.RightHand
				local lefthand = Character.LeftHand
				
				-- Inmobilize Player --
				Humanoid.WalkSpeed = 0
				Humanoid.JumpPower = 0
				
			    -- Pre Position --
				genkiOut.CFrame = righthand.CFrame:Lerp(lefthand.CFrame, 0.5)
				genkiOut.CFrame = genkiOut.CFrame + Vector3.new(0,7,0)
			
				
				-- Growth Animation --
				animationnum = {1,2}
				animationstatuswanted = {"start", "loop"}
				revent:FireClient(plr, animationnum, animationstatuswanted)	
				repeat wait() until animationfinishedreceived == true
				animationfinishedreceived = false
				
				-- Genki Position and Welding --
				
				local weld = Instance.new("WeldConstraint", righthand)
				weld.Part0 = righthand
				genkiOut.Anchored = false
				weld.Part1 = genkiOut
				genkiOut.Transparency = 0.8
				genkiIn.Transparency = 0
				
			
			
				-- Genki Growth -- 
				for i, v in pairs(genkiFolder:GetDescendants()) do
					if v:IsA("Part") then 
						local growthgoal = {Size = Vector3.new(34,34,34), Position = v.Position + Vector3.new(0,15,0)}
						local growthinfo = TweenInfo.new(5)
						if v.Name == "GenkiOut" then
							growthgoal = {Size = Vector3.new(38,38,38), Position = v.Position + Vector3.new(0,15,0)}
						end
						local growthtween = ts:Create(v, growthinfo, growthgoal)
						growthtween:Play()
					elseif v:IsA("ParticleEmitter") then
						if v.Name == "Recollect" then
							v.Enabled = true
						else
							genkiOut:GetPropertyChangedSignal("Size"):Connect(function()		
								if genkiOut.Size == Vector3.new(38,38,38) then
									v.Enabled = true
									fireready = true
								end
							end)
		
						end
					end
				end	
		
			elseif active == true then
				print("numb2 works")
				repeat wait() until fireready == true
				alreadycrashed = false
				
				-- Stopping last animations --
				animationnum = 2
				animationstatuswanted = "stop"
				revent:FireClient(plr, animationnum, animationstatuswanted)
				print("sent")
				
				-- Recuperando Variables --
				local genkiFolder = workspace:FindFirstChild(plr.Name.."Genki")
				local genkiOut = genkiFolder:FindFirstChild("GenkiOut")
				local genkiIn = genkiOut:FindFirstChild("Genki")
				local weld = Character.RightHand:FindFirstChild("WeldConstraint")
				local recollectparticle = genkiIn:FindFirstChild("Recollect")
				local glowparticle = genkiOut.Attachment:FindFirstChild("Glow")
				local firstWave = genkiOut:FindFirstChild("FirstWave")
				local midWave = genkiOut:FindFirstChild("MidWave")
				local lastWave = genkiOut:FindFirstChild("FinalWave")
	
				-- Throw Animation --
				animationnum = {3,4}
				animationstatuswanted = "start"
				revent:FireClient(plr, animationnum, animationstatuswanted)
				repeat wait() until animationfinishedreceived == true
				print("fire xd")
				
				-- Throw Genki --
				weld:Destroy()
				local bodyvelo = Instance.new("BodyVelocity", genkiOut)
				bodyvelo.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
				bodyvelo.P = 10000
				bodyvelo.Velocity = CFrame.new(genkiOut.Position, mouse).LookVector*100
				
				-- Touched Part and Event --
				local explosionPart = Instance.new("Part", genkiOut)
				explosionPart.Anchored = true
				explosionPart.CanCollide = false
				explosionPart.Shape = Enum.PartType.Ball
				explosionPart.Size = Vector3.new(0.1,0.1,0.1)
				explosionPart.Material = Enum.Material.Neon
				explosionPart.Color = Color3.new(0.333333, 1, 1)
				explosionPart.CFrame = genkiOut.CFrame + Vector3.new(0,5,0)
				explosionPart.Transparency = 0
				explosionPart.Name = "ExplosionPart"
				local exploWeld = Instance.new("WeldConstraint", genkiOut)
				exploWeld.Part0 = genkiOut
				explosionPart.Anchored = false
				exploWeld.Part1 = explosionPart
				local detectionPart = Instance.new("Part", genkiOut)
		
				
				genkiOut.Touched:Connect(function(Hit)		
					if Hit:IsA("Part") or Hit:IsA("MeshPart") then
						if not Hit:IsDescendantOf(genkiFolder) and not Hit:IsDescendantOf(Character) then
							local HitHum = Hit.Parent:FindFirstChild("Humanoid")
							if HitHum then
								if not Hit.Parent:FindFirstChild("Damaging") then
									local damaging = Instance.new("BoolValue", Hit.Parent)
									damaging.Name = "Damaging"
									HitHum:TakeDamage(25)
									game.Debris:AddItem(damaging, 2)
								end
							end
						end
					end
				end)
				
				explosionPart.Touched:Connect(function(Hit)
					if Hit:IsA("Part") or Hit:IsA("MeshPart") then
						if not Hit:IsDescendantOf(genkiFolder) and not Hit:IsDescendantOf(Character) then
							bodyvelo:Destroy()
							genkiOut.Anchored = true
							local HitHum = Hit.Parent:FindFirstChild("Humanoid")
							if HitHum then
								if not Hit.Parent:FindFirstChild("AlreadyHit") then
									local alreadyHit = Instance.new("BoolValue", Hit.Parent)
									alreadyHit.Name = "AlreadyHit"
									HitHum:TakeDamage(50)
									game.Debris:AddItem(alreadyHit, 20)
								end
							elseif HitHum == nil and alreadycrashed == false then
								alreadycrashed = true
								
								-- Final Effects --
								
								local bouncecount = 0
								local wavecount = 0
								local function effects(v, case)
									if case == "part" then
										local inCasePart = coroutine.create(function()
											repeat
												local bouncegoal = {Size = v.Size + Vector3.new(5,5,5)}
												local info = TweenInfo.new(1)
												local bouncetween = ts:Create(v, info, bouncegoal)
												bouncetween:Play()
												bouncetween.Completed:Connect(function()
													bouncegoal = {Size = v.Size - Vector3.new(5,5,5)}
													bouncetween = ts:Create(v, info, bouncegoal)
													bouncetween:Play()
													bouncecount = bouncecount + 1
												end)
												wait(2)
											until bouncecount == 8
										end)
										coroutine.resume(inCasePart)
									elseif case == "meshpart" then
										local inCaseMesh = coroutine.create(function()
											repeat
												if v.Name == "FirstWave" then
													local firstClone = v:Clone()
													firstClone.Parent = firstWave
													firstClone.Position = explosionPart.Position + Vector3.new(0,1,0)
													local sizegoal = {Size = Vector3.new(50,10,50), Orientation = Vector3.new(0,360,0)}
													local transgoal = {Transparency = 1}
													local info = TweenInfo.new(1)
													local info2 = TweenInfo.new(4)
													local sizetween = ts:Create(firstClone, info, sizegoal)
													local transtween = ts:Create(firstClone, info2, transgoal)
													sizetween:Play()
													transtween:Play()
													wavecount = wavecount + 0.5
												elseif v.Name == "MidWave" then
													local midClone = v:Clone()
													midClone.Parent = midWave
													midClone.Position = explosionPart.Position 
													midClone.Size = Vector3.new(55,2.111,55)
													local info = TweenInfo.new(2)
													local transinfo = TweenInfo.new(4)
													local goal = {Size = midClone.Size - Vector3.new(20,0,20), Orientation = Vector3.new(0,360,0), Position = midClone.Position + Vector3.new(0,15,0)}
													local transgoal = {Transparency = 1}
													local tween = ts:Create(midClone, info, goal)
													local transtween = ts:Create(midClone, info, transgoal)
													tween:Play()
													transtween:Play()
													wavecount = wavecount + 0.5
												elseif v.Name == "LastWave" and wavecount == 7 then
													local lastClone = v:Clone()
													lastClone.Parent = lastWave
													lastClone.CFrame = explosionPart.CFrame
													local info = TweenInfo.new(4)
													local goal = {Size = lastClone.Size + Vector3.new(60,0,60), Transparency = 1}
													local tween = ts:Create(lastClone, info, goal)
													tween:Play()
													wavecount = wavecount + 0.5
												end
												wait(2)
											until wavecount == 8.5
										end)
										coroutine.resume(inCaseMesh)
									end
								end
								
								
								
								
								wait(2)
								for i, v in pairs(genkiFolder:GetDescendants()) do
									if v:IsA("Part") then
										local case = "part"
										effects(v, case)
									elseif v:IsA("MeshPart") then
										local case = "meshpart"
										effects(v, case)
									elseif v:IsA("ParticleEmitter") then
										
									end
								end
								
							end
						end
					end
				end)
				
				
				
				
			end
		elseif animationfinished ~= nil then
			if animationfinished == true then
				animationfinishedreceived = true
			end
		end
	end
end)
´´´
1 Like

Can you provide the script instead of a gyazo.com link. Use three ` at the beginning and end of it to make it look like a real script.

Example:

local tool = game.ReplicatedStorage.FireBall:Connect(function(player)
   -- This is example.
end

The entire script, or just a specific part?

1 Like

The entire so we can help you. You could do part of it but I would recommend the full thing.

It won’t let me send it, hold on.

1 Like

Just Ctrl-C then Ctrl-V post when your ready. Do it from studio not from gyazo.com.

Can I send you a text file? It says 403 Error when I try to send the script.

1 Like

I am not clicking on any links or downloading any files.

Finally, I reposted it, sorry for making you wait.

What is revent? A function or object?

Its a remote event. It fires from a local script inside of the tool.

1 Like

Can you take a screenshot of the layout. If its a remote event you have to name the location first

Like this

local revent = -- Location of the remote event.

revent.OnServerEvent:Connect(function(plr, mouse, active, animationfinished)
	local Humanoid = plr.Character.Humanoid
	local Character = plr.Character
	if Humanoid.Health > 0 then 
		if mouse ~= nil and active ~= nil then
			print("numb1 works")
			if active == false then
				
				-- Principal Vars --
				local genkiFolder = Instance.new("Folder", workspace)
				genkiFolder.Name = plr.Name.."Genki"
				local genkiOut = script.GenkiOut:Clone()
				genkiOut.Parent = genkiFolder

				local genkiIn = genkiOut.Genki
				local glowParticle = genkiOut.Attachment.Glow
				local recollectParticle = genkiIn.Recollect
				local chargetrack = Humanoid:LoadAnimation(genkicharge)
				local chargetrackloop = Humanoid:LoadAnimation(genkichargeloop)
				local righthand = Character.RightHand
				local lefthand = Character.LeftHand
				
				-- Inmobilize Player --
				Humanoid.WalkSpeed = 0
				Humanoid.JumpPower = 0
				
			    -- Pre Position --
				genkiOut.CFrame = righthand.CFrame:Lerp(lefthand.CFrame, 0.5)
				genkiOut.CFrame = genkiOut.CFrame + Vector3.new(0,7,0)
			
				
				-- Growth Animation --
				animationnum = {1,2}
				animationstatuswanted = {"start", "loop"}
				revent:FireClient(plr, animationnum, animationstatuswanted)	
				repeat wait() until animationfinishedreceived == true
				animationfinishedreceived = false
				
				-- Genki Position and Welding --
				
				local weld = Instance.new("WeldConstraint", righthand)
				weld.Part0 = righthand
				genkiOut.Anchored = false
				weld.Part1 = genkiOut
				genkiOut.Transparency = 0.8
				genkiIn.Transparency = 0
				
			
			
				-- Genki Growth -- 
				for i, v in pairs(genkiFolder:GetDescendants()) do
					if v:IsA("Part") then 
						local growthgoal = {Size = Vector3.new(34,34,34), Position = v.Position + Vector3.new(0,15,0)}
						local growthinfo = TweenInfo.new(5)
						if v.Name == "GenkiOut" then
							growthgoal = {Size = Vector3.new(38,38,38), Position = v.Position + Vector3.new(0,15,0)}
						end
						local growthtween = ts:Create(v, growthinfo, growthgoal)
						growthtween:Play()
					elseif v:IsA("ParticleEmitter") then
						if v.Name == "Recollect" then
							v.Enabled = true
						else
							genkiOut:GetPropertyChangedSignal("Size"):Connect(function()		
								if genkiOut.Size == Vector3.new(38,38,38) then
									v.Enabled = true
									fireready = true
								end
							end)
		
						end
					end
				end	
		
			elseif active == true then
				print("numb2 works")
				repeat wait() until fireready == true
				alreadycrashed = false
				
				-- Stopping last animations --
				animationnum = 2
				animationstatuswanted = "stop"
				revent:FireClient(plr, animationnum, animationstatuswanted)
				print("sent")
				
				-- Recuperando Variables --
				local genkiFolder = workspace:FindFirstChild(plr.Name.."Genki")
				local genkiOut = genkiFolder:FindFirstChild("GenkiOut")
				local genkiIn = genkiOut:FindFirstChild("Genki")
				local weld = Character.RightHand:FindFirstChild("WeldConstraint")
				local recollectparticle = genkiIn:FindFirstChild("Recollect")
				local glowparticle = genkiOut.Attachment:FindFirstChild("Glow")
				local firstWave = genkiOut:FindFirstChild("FirstWave")
				local midWave = genkiOut:FindFirstChild("MidWave")
				local lastWave = genkiOut:FindFirstChild("FinalWave")
	
				-- Throw Animation --
				animationnum = {3,4}
				animationstatuswanted = "start"
				revent:FireClient(plr, animationnum, animationstatuswanted)
				repeat wait() until animationfinishedreceived == true
				print("fire xd")
				
				-- Throw Genki --
				weld:Destroy()
				local bodyvelo = Instance.new("BodyVelocity", genkiOut)
				bodyvelo.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
				bodyvelo.P = 10000
				bodyvelo.Velocity = CFrame.new(genkiOut.Position, mouse).LookVector*100
				
				-- Touched Part and Event --
				local explosionPart = Instance.new("Part", genkiOut)
				explosionPart.Anchored = true
				explosionPart.CanCollide = false
				explosionPart.Shape = Enum.PartType.Ball
				explosionPart.Size = Vector3.new(0.1,0.1,0.1)
				explosionPart.Material = Enum.Material.Neon
				explosionPart.Color = Color3.new(0.333333, 1, 1)
				explosionPart.CFrame = genkiOut.CFrame + Vector3.new(0,5,0)
				explosionPart.Transparency = 0
				explosionPart.Name = "ExplosionPart"
				local exploWeld = Instance.new("WeldConstraint", genkiOut)
				exploWeld.Part0 = genkiOut
				explosionPart.Anchored = false
				exploWeld.Part1 = explosionPart
				local detectionPart = Instance.new("Part", genkiOut)
		
				
				genkiOut.Touched:Connect(function(Hit)		
					if Hit:IsA("Part") or Hit:IsA("MeshPart") then
						if not Hit:IsDescendantOf(genkiFolder) and not Hit:IsDescendantOf(Character) then
							local HitHum = Hit.Parent:FindFirstChild("Humanoid")
							if HitHum then
								if not Hit.Parent:FindFirstChild("Damaging") then
									local damaging = Instance.new("BoolValue", Hit.Parent)
									damaging.Name = "Damaging"
									HitHum:TakeDamage(25)
									game.Debris:AddItem(damaging, 2)
								end
							end
						end
					end
				end)
				
				explosionPart.Touched:Connect(function(Hit)
					if Hit:IsA("Part") or Hit:IsA("MeshPart") then
						if not Hit:IsDescendantOf(genkiFolder) and not Hit:IsDescendantOf(Character) then
							bodyvelo:Destroy()
							genkiOut.Anchored = true
							local HitHum = Hit.Parent:FindFirstChild("Humanoid")
							if HitHum then
								if not Hit.Parent:FindFirstChild("AlreadyHit") then
									local alreadyHit = Instance.new("BoolValue", Hit.Parent)
									alreadyHit.Name = "AlreadyHit"
									HitHum:TakeDamage(50)
									game.Debris:AddItem(alreadyHit, 20)
								end
							elseif HitHum == nil and alreadycrashed == false then
								alreadycrashed = true
								
								-- Final Effects --
								
								local bouncecount = 0
								local wavecount = 0
								local function effects(v, case)
									if case == "part" then
										local inCasePart = coroutine.create(function()
											repeat
												local bouncegoal = {Size = v.Size + Vector3.new(5,5,5)}
												local info = TweenInfo.new(1)
												local bouncetween = ts:Create(v, info, bouncegoal)
												bouncetween:Play()
												bouncetween.Completed:Connect(function()
													bouncegoal = {Size = v.Size - Vector3.new(5,5,5)}
													bouncetween = ts:Create(v, info, bouncegoal)
													bouncetween:Play()
													bouncecount = bouncecount + 1
												end)
												wait(2)
											until bouncecount == 8
										end)
										coroutine.resume(inCasePart)
									elseif case == "meshpart" then
										local inCaseMesh = coroutine.create(function()
											repeat
												if v.Name == "FirstWave" then
													local firstClone = v:Clone()
													firstClone.Parent = firstWave
													firstClone.Position = explosionPart.Position + Vector3.new(0,1,0)
													local sizegoal = {Size = Vector3.new(50,10,50), Orientation = Vector3.new(0,360,0)}
													local transgoal = {Transparency = 1}
													local info = TweenInfo.new(1)
													local info2 = TweenInfo.new(4)
													local sizetween = ts:Create(firstClone, info, sizegoal)
													local transtween = ts:Create(firstClone, info2, transgoal)
													sizetween:Play()
													transtween:Play()
													wavecount = wavecount + 0.5
												elseif v.Name == "MidWave" then
													local midClone = v:Clone()
													midClone.Parent = midWave
													midClone.Position = explosionPart.Position 
													midClone.Size = Vector3.new(55,2.111,55)
													local info = TweenInfo.new(2)
													local transinfo = TweenInfo.new(4)
													local goal = {Size = midClone.Size - Vector3.new(20,0,20), Orientation = Vector3.new(0,360,0), Position = midClone.Position + Vector3.new(0,15,0)}
													local transgoal = {Transparency = 1}
													local tween = ts:Create(midClone, info, goal)
													local transtween = ts:Create(midClone, info, transgoal)
													tween:Play()
													transtween:Play()
													wavecount = wavecount + 0.5
												elseif v.Name == "LastWave" and wavecount == 7 then
													local lastClone = v:Clone()
													lastClone.Parent = lastWave
													lastClone.CFrame = explosionPart.CFrame
													local info = TweenInfo.new(4)
													local goal = {Size = lastClone.Size + Vector3.new(60,0,60), Transparency = 1}
													local tween = ts:Create(lastClone, info, goal)
													tween:Play()
													wavecount = wavecount + 0.5
												end
												wait(2)
											until wavecount == 8.5
										end)
										coroutine.resume(inCaseMesh)
									end
								end
								
								wait(2)
								for i, v in pairs(genkiFolder:GetDescendants()) do
									if v:IsA("Part") then
										local case = "part"
										effects(v, case)
									elseif v:IsA("MeshPart") then
										local case = "meshpart"
										effects(v, case)
									elseif v:IsA("ParticleEmitter") then
										
									end
								end
								
							end
						end
					end
				end)
				
			end
		elseif animationfinished ~= nil then
			if animationfinished == true then
				animationfinishedreceived = true
			end
		end
	end
end)

Okay got it, I updated the post.

1 Like

I have no idea about the new one. Just the one I showed you. Hope it helps none-the-less!

1 Like

Well, thanks anyway !! Sorry if I didn’t explain the issue quite well.

2 Likes