I’ve been struggling with understanding how to create a boomerang attack for my current project, i’ve got everything working but it all fires through a “FireAllClients
” event meaning that every player fires a raycast
from the user and calculates everything which I’m assuming isn’t the best way of going about this… I dont want to use Server-Side hitboxes due to the potential delay and un-responsiveness they can bring… how would I handle firing the raycasts
, hitbox and boomerang being thrown on the client while also displaying it to all OTHER clients at the same time? Maybe handling everything on all clients isn’t actually a huge issue but I would love feedback on this, thanks.
try using tween service back an forward
Tween service completely ignores physics, so it’s not viable for a physics-affecting object
Firing all clients is a good way to avoid replication lag and show events to everyone. But it’s tedious to manage. So I would suggest instead firing a bindable event from the local script which is straightforward and simple. However you wanna do the calculations in the local script of the player that fired it. Here’s what I mean
local rang = script.Parent — Assuming script is in the boomerang
local player = game.Players.LocalPlayer
player:GetMouse().Button1Down:Connect(function()
— Logic to check if equipped
— Do calculations to determine positions to lerp to
rang.ThrowBoomerang:Fire(pos1,pos2) — Some positions to send
end)
rang.ThrowBoomerang.OnEvent:Connect(function(pos1,pos2)
— Throw the boomerang here for all clients to see it
end)
how complicated are you willing to go
what do u mean by that? Hit me with ur best and most efficient way of handling this and i’ll tell you if I don’t understand it, I consider myself capable
all of the simplistic/naive methods become pretty apparent with a demo like laggy cannons [game] (fandom website sucks, sorry)
if your projectiles are going to be real-physics-based then going with one of these + sanity checks is probably your best bet
otherwise,
- the replication of the projectile is pretty easy all things considered
- the hit detection is not an easy step to do right and you’d be getting into the world of rollback netcode and server authority, let me know if you want me to elaborate
ok so after a lot of trial and error I came to the realization that I can just handle the hit detection on the Client while displaying the Boomerang through all Clients and only fire hit checks from the user of the Boomerang… To simplify it, the basic idea is this:
- Client (Input to fire Boomerang)
- Server (Basic Boomerang checks) this fires to the users Client AND all other Clients in unison
- Client (Animations, Sounds, Private VFX, Hit Detection) IF HIT fire to Server for sanity
- All Clients (Throws Boomerang for all Players)
- Server (IF Client hits someone, run checks, if true then fire AllClients to display Hit VFX)
- All Clients (Finally, handle hit VFX, Sounds and other things for ALL players to see)
NOTE:
I personally wrote my own Ability / Attack framework for my current Project that this Boomerang attack is being used in, it makes handling Server / Client / All Clients a lot more organised so this may seem confusing or extra for some…
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.