How would I go about playing effects on the client? My main two ideas currently is to make a local script that checks everything the server script does, then plays effects, to fire a remote event with a number “id” that would be checked and then every single effect would have its own id with custom scripts.
If you try to make the server and the client play an effect at the same time, you will have to create a local script and a server script, there is no other way.
But if you try to make the client effects also play on the server, create a server script that will put in a table the effects and give them to the client, then when the client wants to play an effect, the client will have to use a remote event :
--SERVER script
local remoteFunction = game.ReplicatedStorage.remoteFunction --Create your own remote function
local playEffectsRE = game.ReplicatedStorage.playEffectRemoteEvent --Create your own remote event
local effects = script:GetDescendants()
remoteFunction.OnServerInvoke = function (player: Player)
for index, effect in effects do
effects[index] = effect:Clone()
effects[index].Parent = player.Character --Whaterver
end
return effects
end
playEffectsRE.OnServerEvent:Connect(function(player, effectName: string)
if effects[effectName] then --Check if the effect exist
effects[effectName].Enabled = true
else
warn("This effect don't exist")
end
end)
--PLAYER script
game.Players.LocalPlayer.CharacterAdded:Wait()
local remoteFunction = game.ReplicatedStorage:WaitForChild("remoteFunction") --Create your own remote function
local playEffectsRE = game.ReplicatedStorage:WaitForChild("playEffectRemoteEvent") --Create your own remote event
local effects = remoteFunction:InvokeServer()
--Play effects (particle emitter for example)
effects["effect name..."].Enable = true --Play on client
playEffectsRE:FireServer("effect name...") --Play on server