Network Ownership

I have projectiles that are constantly rotating and facing the player’s mouse, so what I did, was set the network owner of the projectile as the player, then in the player’s client I handle the rotation. After the player releases the key I shoot the projectile, and detect the collision on the server.

Server Script -

local vfx = Instance.new('Folder')
vfx.Name = plr.Name..' VFX'
vfx.Parent = game.Workspace.VFX
			
local table = {}
			
for i = 1, 3 do
			
	local spear = folder['Ice Spear']:Clone()
	table[#table + 1] = spear
				
	local wc = Instance.new('WeldConstraint')
	wc.Part0 = spear.Main
	wc.Part1 = spear.Ice
	wc.Parent = spear.Main
				
	spear.Parent = vfx
				
	for i, v in pairs(spear:GetChildren()) do
					
		v.Size = Vector3.new(0, 0, 0)
		v:SetNetworkOwner(plr)

	end
				
	local connection
				
	connection = spear.Main.Touched:Connect(function(hit)
					
		connection:Disconnect()
					
		remote:FireAllClients(plr, set, skill..'2', spear.Main.Position)
					
		spear:Destroy()
					
	end)
				
end
			
remote:FireClient(plr, plr, set, skill, table)

Client Script -

local cfs = {CFrame.new(-5, 0, 0), CFrame.new(0, 5, 0), CFrame.new(5, 0, 0)}
			
local time = tick()
			
for i, v in pairs(x) do
			
	v.Main.Anchored = true
				
	local wc = Instance.new('WeldConstraint')
	wc.Part0 = v.Main
	wc.Part1 = v.Ice
	wc.Parent = v.Main
				
	v.Main.CFrame = hrp.CFrame * cfs[i]
				
	TS:Create(v.Main, TweenInfo.new(.5), {

		Size = folder['Ice Spear'].Main.Size;

	}):Play()
				
	coroutine.wrap(function()
					
		wait(.5)

		TS:Create(v.Ice, TweenInfo.new(.5), {

			Size = folder['Ice Spear'].Ice.Size;

		}):Play()
					
	end)()
				
end
			
local connection
			
connection = RS.RenderStepped:Connect(function()

	hrp.CFrame = CFrame.new(hrp.Position, mouse.Hit.Position)
				
	for i, v in pairs(x) do
					
		v.Main.CFrame = hrp.CFrame * cfs[i]
		v.Main.CFrame = CFrame.new(v.Main.Position, mouse.Hit.Position) * CFrame.Angles(math.rad(-90), 0, 0)
					
	end

	if plr['Ice - C'].Value == false and (tick() - time) > .5 then

		connection:Disconnect()
					
		for i, v in pairs(x) do
					
			TS:Create(v.Main, TweenInfo.new(1), {
							
				CFrame = v.Main.CFrame * CFrame.new(0, 50, 0);
							
			}):Play()
						
		end

	end

end)

Almost everything works fine, what doesn’t is the part where it detects the collision on the server, Touched doesn’t fire.

If y’all know how I can fix this, or can tell me a better way of doing it, I’d really appreciate it!

one thing I learned about the .Touched event, and I hope this answers your question, is that it relies on network ownership to fire, but if you shoot it extremely fast, the .Touched event will either fire late or not at all. The best way I have found to get around this is either by making the projectile slower or but casting a forward facing ray in a loop to detect if its about to hit a wall.

Aight thx, what I did was detect collision on the client, and fire a ray from an attachment to another every frame, and when it hits fire to the server for handling damage, with a debounce so exploiters can damage more than once