Hello! I’m making a game, where I tween a preset above player’s head. Currently, I’m handling all the tweening on Server. It is alright, until I hit 210+ ping, it becomes a bit laggy and on phone it is very laggy. So my question is, should I handle tweening on Client?
I can send the script if you want, but I think it is not needed at the moment.
Special effects, such as tweening, should be handled on the client. This is to reduce the load on the server. The server usually does not handle visual effects (and should never)
The short answer is: If you can yes. Do it on the client.
You dont want to dedicate the server to perform a lot of tasks such as tweening as it can drastically descrease performance instead you want to FireClient() whenever a tween is needed and perform it via the local machine although there are cases where you may want to do it on the server, I dont think you need to here.
Okay, thank you. I have one more question. This is my script:
function TweenPreset(speed)
local TweenService = game:GetService("TweenService")
local Preset = workspace.SelectedPreset.Preset
local PresetRoot = Preset.SkyPieceCenter
local PresetInfo = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local goal = {}
goal.CFrame = CFrame.new(0,-0.5,0)
local goal2 = {}
goal2.Transparency = 0
local PresetMove = TweenService:Create(PresetRoot, PresetInfo, goal)
--print("Starting Tween")
for i, part in pairs(workspace.Shadow:GetChildren()) do
if part.Name ~= "SkyPieceCenter" then
local PresetTween = TweenService:Create(part, PresetInfo, goal2)
PresetTween:Play()
end
end
PresetMove:Play()
print("Moving")
wait(speed-.1)
workspace.Shadow:Destroy()
wait(.1)
workspace.Sounds.Thud1:Play()
wait(.1)
workspace.SelectedPreset.Preset:Destroy()
--workspace.Shadow:Destroy()
end
I need to know, if I should make the Preset on the client, or if I can just pass it through the Remote Event?
EDIT: Also, I’m getting .Touched event on the server, if the player touches the tweening preset, they get killed. How should I handle it now?
If I were you I’d only ever tween or do effects on the client-side, as doing it on the server would induce a large load and as such more server to client lag.
Yes, you should handle CFrame tweening on the client, I used to do CFrame tweening on the server and then whilst making a spinning part using tweens, I realized my script activity started to skyrocket and lag the server.