Making an ability where the player spawns a rock wall from beneath the floor that then rises above the floor. It will then launch forward.
Two main options I have to make it move:
tweening on client
iffy on this because tweening on client is not neccesarily secure and may be annoying in a combat game for obvious reasons
linear velocities on server
i will have to make custom scripts to control it nicely, which i dont mind doing but yknow
I am really shooting for reliability here; not as worried about aesthetics. Nothing is worse than bad hitboxes that dont match the position of the object.
For option 2, heres a little module I cooked up as a reference as to what I mean.
local module = {}
function module.accelerate(part, goalVelocity, duration)
local velocity = part:WaitForChild("LinearVelocity")
local steps = duration / 0.01
local increment = (goalVelocity - velocity.VectorVelocity) / steps
for i = 1, steps do
velocity.VectorVelocity += increment
task.wait(0.01)
end
velocity.VectorVelocity = goalVelocity
return true
end
function module.decelerate(part, goalVelocity, duration)
local velocity = part:WaitForChild("LinearVelocity")
local steps = duration / 0.01
local decrement = (velocity.VectorVelocity - goalVelocity) / steps
for i = 1, steps do
velocity.VectorVelocity -= decrement
task.wait(0.01)
end
velocity.VectorVelocity = goalVelocity
return true
end
function module.createVelocity(part, initialVelocity)
local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.Name = "LinearVelocity"
linearVelocity.Attachment0 = Instance.new("Attachment", part)
linearVelocity.VectorVelocity = initialVelocity
linearVelocity.Parent = part
end
function module.changeVelocity(part, newVelocity)
if part:FindFirstChild("LinearVelocity") then
part.LinearVelocity.VectorVelocity = newVelocity
end
end
function module.destroyVelocity(part)
if part:FindFirstChild("LinearVelocity") then
part.LinearVelocity:Destroy()
end
end
return module
well, both solutions give client ownership of the projectile, since network ownership for unanchored stuff, so just do whichever one is easier for you to make, and looks nicer, either way it can be exploited.
Probably. My only concern with this is that the animations will not align with the actual damage done on the server. I’ve played fighting games a lot and it sucks when you get launched when nothing even hits you, or at least you dont see it hit you.
Also, this would require moving the model on the server at the same time as it is being tweened on the client.
I still think tweenservice is fine on the server, but however you plan to move the projectile, for server ownership of the hit detection, use multiple raycast: Raycasting | Documentation - Roblox Creator Hub, or shape cast/Spherecast/BlockCast: WorldRoot | Documentation - Roblox Creator Hub, or use GetPartBoundsInBox, or really any of the other random methods in worldroot stuff: WorldRoot | Documentation - Roblox Creator Hub
Everything in there is checked by the server, and doesn’t use .touched events or anything that can be manipulated by the client.
Yeah im not sure how far you can get to get 1:1 ratio for the ping difference across all players for fighting. I’d just in my opinion probably animate the object on the client(s) and hitreg it on the server; if you were to animate it on the server there’d probably be delay anyways on what the server replicates to the clients.
Also I dont think you need to move the model on the server, if you have a set distance like if the object being thrown is to a certain distance you could probably use FastCast or ShapeCast or just Normal Raycast, all can give you some hitregs. Its up to opinion honestly
For projectiles, I could tween it on client but it’s actual position stays the same. So, I couldn’t raycast it as it moves because it isn’t moving. Unless you meant that if a client registers it as hit then I can check it on the server.
just have a simulated position on the server, just scan using whatever method you want, raycast, parts in bounds, shape cast, whatever, along where the projectile would be.
like scan, lets say 1 stud ahead, then wait, scan from that point 1 stud ahead, and then clients can do their own tweens or whatever with the projectiles. But I would suggest the server give updates where the projectile is so nothing gets out of track.
but actualy yeah prob 0.1 studs would be better, but the idea is that you don’t need to put a part in workspace, and can just keep track of the vector3
You could do a hit reg register on the client and do sanity checks towards the server i mean this would really be optimized way to reduce ping difference when something lands.
What I was saying though is that like say when Player1 spawns a rock wall which rises and launches forward. This player can notify the server which notifies Player2,Player 3 and so forth that this player is doing a certain action. Now on player2 and player3 they can all replicate this on their side, and if Player1 registers a hit on HIS side, he can send a server event notifying he hit something in a certain POSITION, and you’d just do sanity checks on the server and register it if it was good.
The pros I do see with this is that its one way i can think of where the fighter itself will recieve + benefits as he will get a less delay for the hit reg, but the cons again could be a slight delay on Player2 and 3 seeing the object(wall) being thrown at them. It’s all up to preference, then again ping difference, theres many ways to doing this its just one way I think its pretty positive and optimized friendly
I’m not really sure this is really needed? Doing a loop for every single wall attack called? That’s just basically fast cast in a nutshell. Its better to do the hitreg on the client and sanity check it on the server(if performance is key ofc)
The server has quite a lot of memory to spare, it seems pretty unnecessary to task every client individually with hit detection instead of just using the servers’s memory, which I’m also now just realizing I misread, since only one client is doing the checks, but either way, seems kinda pointless to not just use the server for it.