Server Side effect is different VS Client side

In my fireball, I have the part move towards the location of the player’s mouses position using BodyVelocity. However, on the client, it explodes when it visually impacts the enemy. On the server-side, it seems to impact it early on, causing the explosion to start early.

Server Side - Left Side
Client-Side - Right Side (Person who fired the fireball)

The entire animation, with particles, is all server sided.

local Debris = game:GetService("Debris")
local debounce = false
script.Parent.FireBall.OnServerEvent:Connect(function(player,mouse)
	
	if not debounce then 
		debounce = true
		
		wait(.2)
		local touchdebounce = false
		newFireBall.Touched:Connect(function(part)
			if part.Parent.Name == player.Name then return end
			if part.Name == "FireBall" then return end
			if part.Parent:FindFirstChild("Humanoid") ~= nil then
				local enemy = game.Players:GetPlayerFromCharacter(part.Parent)
				if enemy.TeamColor ~= player.TeamColor then
					if not touchdebounce then
						touchdebounce = true
						part.Parent.Humanoid:TakeDamage(12)
						FireBallExplosion(newFireBall)
						wait(1)
						touchdebounce = false
					end
				end
			end
		end)
		wait(2)
		if newFireBall ~= nil then 
			FireBallExplosion(newFireBall)
		end
		debounce = false
	end
end)

I took some code out of the script that would not effect it.

6 Likes

I tried setting the networking ownership to the server, however it looks worse now.

1 Like

Never mind. I solved it. I first set the NetWorkOwnership to the server to make it more secure. Once I did that, I made the fireball on all the clients to handle the effects. While on the server, I had an invisible ball flying and handling the touched event.

  • Server Side (Handles touched event)
  • Client-Side (Handles the particles/animations)
6 Likes

I know this is late, but how did you make the fireball on all the clients

1 Like

RemoteEvent:FireAllClients(). You can use this to fire a remote event to every client for the effect and stuff.

2 Likes

Could you show us the results if possible?