Hello! So I know that it is best to run as many things as possible on the client to not burden the server, and visuals is one of them. But, to what extent should visuals be done on the client? Can I add a local script to every player that handles all of the visuals, with a server firing a remote event to give instructions to the client to handle the visual?
Server script (or, maybe at least 10 of this same server script since a game probably has many visuals)
local visualevent = game:GetService("ReplicatedStorage").VisualEvent -- remote event
-- Some random events i guess
part.Touched:Connect(function()
visualevent:FireAllClients("A")
end)
anotherpart.Touched:Connect(function()
visualevent:FireAllClients("B")
end)
yetanotherpart.Touched:Connect(function()
visualevent:FireAllClients("why are there so many parts")
end)
-- And it could go on and on...the point is that there could be many functions linked to this event
Local script inside character
local player = game.Players.LocalPlayer
local character = script.Parent
local visualevent = game:GetService("ReplicatedStorage").VisualEvent
visualevent.OnClientEvent:Connect(function(visualtype)
if visualtype == "A" then
-- Visual for when "part" is touched
elseif visualtype == "B" then
-- Visual for when "anotherpart" is touched
elseif visualtype == "why are there so many parts" then
-- Visual for when "yetanotherpart" is touched
end
end)
-- There could be infinite number of these "visual types"
If this is how visuals are handled, would the local script handling the visuals get overwhelmed? Because if clients are to handle as many visuals as possible, using one script to handle it all seems to be the best way to go instead of having multiple local scripts handling individual visuals.