Basically I’m looking for the most optimal way to do skills and effects out there.
Heres a example of how I usually do things and want to know the best way, I appreciate it!
I fire the skill and then send to the server so it can send back to all clients to do effects then when a animation signal is reached I send to the server to do the hitbox.
Found a better way to do effects but I still need to fire to the server twice once for the hitbox and once for the effects and when I fire for effects I have to fireallclients back everytime so I'm not sure if theres a better way for that but now I fire back the skill and it automatically gets the function out of the dictionary that matches.
--Client
local Ani = Animator:LoadAnimation(Script:WaitForChild("Ani")
local function GetSignal(Ani)
ani:GetMarkerReachedSignal:Connect(function()
Re:FireServer("GroundSmashHitbox")
end)
end)
local function Skill()
Re:FireServer("GroundSmashStarted)
Ani:Play()
GetSignal(Ani)
end
Re.OnClientEvent:Connect(function(Player,Skill)
if Skill == "GroundSmashFX" then
--DoEffects
end
end)
Tool.Activated:Connect(function(Skill)
-------------------------------------
--Server
Re.OnServerEvent:Connect(function(Player,Skill)
If Skill == "GroundSmashStarted" then
Re:FireAllClients(Player,"GroundSmashFX")
elseif Skill == "GroundSmashHitbox" then
--Hitbox and damage if a player is found
end
end)