Say I have a object, and on the server I want it to tween it so it get bigger. However, I also want to make it look smooth so should I do the tweening on the server, client, or both…?
I would also like to add that this isn’t just purely visuals, server checks will be made but it wont be able to detect it if its only on the client.
It would depend, suppose there is a parkour game with a floor increasing in size to complete the course, setting it on the client would be an unfair advantage.
And if the server is overwhelmed with something (checks, unefficient scripts) and this part enlarging does not effect the gameplay, I’d set it for client.
To answer your question, It would be practical to set it to the server since the server getting overwhelmed is a very rare case.
what checks are you going to do on the server side?
As the object grows, I want to constantly check if players are inside the object.
Then its highly recommend you set it to server
you could do something like this if you want it done on the client side
-- server
local position = Vector3.new(0, 4, -50)
local numberValue = Instance.new("NumberValue")
numberValue.Name = "MyCoolName"
numberValue:SetAttribute("Position", position)
numberValue.Parent = workspace
local function IsPlayerOnPart(character)
local characterPosition = Vector3.new(character.PrimaryPart.Position.X, 0, character.PrimaryPart.Position.Z)
local partPosition = Vector3.new(position.X, 0, position.Z)
if (characterPosition - partPosition).Magnitude < numberValue.Value then
return true
else
return false
end
end
while true do
numberValue.Value = math.random(20, 40)
task.wait(5)
end
-- client
local numberValue = workspace:WaitForChild("MyCoolName")
local part = instance.new("Part")
part.Anchored = true
part.Shape = enum.PartType.Cylinder
part.position = numberValue:GetAttribute("Position")
part.Orientation = Vector3.new(0, 0, 90)
part.Size = Vector3.new(1, numberValue.Value, numberValue.Value)
part.Parent = workspace
numberValue.Changed:Connect(function(value)
local tween = TweenService:Create(part, tweenInfo, {Size = Vector3.new(1, value, value)})
tween:Play()
end)