I want to have both client-side tweens that are called by a server event move an attachment smoothly. When one client sends an input to call a remote the server fires an event on all clients that plays the tween on an attachment. The client that sent the remote event has a normal tween, while the other’s segmented and stays in one spot before teleporting to the next, instead of a smooth transition. This is odd because both the attachment and tween are handled by the client.
I recreated the problem in an example game here:
tweenExample.rbxl (76.0 KB)
Here is a video demonstrating the problem, a part is being repeatedly created on the tweened attachment to demonstrate:
local script
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")
local runService = game:GetService("RunService")
local playerGui = player:WaitForChild("PlayerGui")
uis.InputBegan:Connect(function(input, gameprocessed)
if gameprocessed then return end
if input.KeyCode == Enum.KeyCode.E then
game.ReplicatedStorage.RemoteEvent:FireServer()
end
end)
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
local attachment0 = Instance.new("Attachment")
local attachment1 = Instance.new("Attachment")
local startPoint = player.Character["Right Arm"].Position - player.Character["Right Arm"].CFrame.UpVector
local endPoint = player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector*30
attachment0.Parent = player.Character["Right Arm"]
attachment0.WorldPosition = startPoint
attachment1.Position = startPoint
attachment0.Orientation = Vector3.new(0, 0, 90)
attachment1.Orientation = Vector3.new(0, 0, 90)
attachment1.Parent = workspace
local beam = Instance.new("Beam")
beam.Texture = "rbxassetid://12694722890"
beam.Color = ColorSequence.new(Color3.fromRGB(57, 57, 57))
beam.Transparency = NumberSequence.new(0)
beam.TextureSpeed = 0
beam.TextureMode = "Static"
beam.Segments = 10
beam.Parent = attachment0
beam.Attachment0 = attachment0
beam.Attachment1 = attachment1
beam.FaceCamera = true
local tweenInfo = TweenInfo.new(.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local tween = game:GetService("TweenService"):Create(attachment1, tweenInfo, {Position = endPoint})
local tweenEnded = false
tween:Play()
tween.Completed:Connect(function()
tweenEnded = true
end)
while tweenEnded == false do
task.wait()
local part = Instance.new("Part")
part.Size = Vector3.new(1,1,1)
part.Anchored = true
part.CanCollide = false
part.Parent = workspace
part.Position = attachment1.WorldPosition
end
end)
server script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireAllClients()
end)
I have read Tweens seem choppy / laggy even though it’s running on the client - Help and Feedback / Scripting Support - Developer Forum | Roblox
but I don’t think it described my problem as I’m only using one tween, and the choppiness is more ordered and uniform than theirs. Any help is greatly appreciated.