I have a “Wipeout” style game coming out soon, but there is a HUGE issue with it: the spinner that knocks/kills players is super buggy, it stutters, and sometimes it will register a hit when it already passed you.
I believe this issue is related to an issue I posted about before,
Basically, in that post, the issue was fixed by, at the start of each round, firing a remote to every client, that would set up a .Touched connection on the client, that would fire a remote to the server, to detect that said client/player touched the spinner. This worked well when there was one or two players, and you can see the code below:
clientRemotes.enableTouch:FireClient(p,kill) --- fires at start of each round, server-sided.
--- below code is the client-sided hit detection
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local rs = game:WaitForChild("ReplicatedStorage")
local sever = rs.serverRemotes
local client = rs.clientRemotes
local touching = false
client.enableTouch.OnClientEvent:Once(function(item:BasePart)
item.CanTouch = true
item.Touched:Connect(function(hit:BasePart)
--if rs.gameInfo:GetAttribute("canTouch") ~= true then return end
if hit.Transparency ~= 0 then return end
if hit and hit.Parent then
if hit.Parent == char then
rs.serverRemotes.killMe:FireServer()
end
end
end)
end)
--- below is the server-sided hit detection that gets fired from the client when client touches spinner
local function hitPlr(plr:Player)
local char = plr.Character or plr.CharacterAdded:Wait()
if char and gameInfo:GetAttribute("canTouch") == true and plr:GetAttribute("touchDB") ~= true then
--- do stuff here
end
end
serverRemotes.killMe.OnServerEvent:Connect(hitPlr)
However, once there are multiple players, especially if they are playing from different parts of the world/country, the spinner got SUPER buggy, and would stutter, have false hits, etc., as seen below:
Now, I have a hunch that this issue is NetworkOwnership related, as the spinner has hit detection run on the client(s), but the spinner itself runs on the server. I have the spinner’s NetworkOwner set to whatever the default is (cause I never set it), so could it be that the spinner is trying to set its NetworkOwnership to the closest player(s), and that’s why this issue happens when there’s more than one or two players?
Any help would be greatly appreciated.