Hey! I’m trying to replicate a character tween. This fired in a local script to a server script which does :FireAllClients and the tween is locally done separately on each client.
The issue here is that the tween plays like it was done from server (delayed and not smooth), but if directly do the function in first place (from the local script) it looks nice (but the tween, which is automatically replicated to server by Roblox, will still look bad). Anyways, I don’t know why this doesn’t work since it is done locally (which shouldn’t be affected by delay).
Local script (remote is fired on other part, which is irrelevant):
--actual tween function
function Tween(x)
x.HumanoidRootPart.Anchored = true
local Ray = Ray.new(x.HumanoidRootPart.Position, x.HumanoidRootPart.CFrame.LookVector*distance)
local Wall, HitPosition, Normal, Material = workspace:FindPartOnRay(Ray, x)
local length = (x.HumanoidRootPart.Position - HitPosition).Magnitude
local CFrameTween = TweenService:Create(x.HumanoidRootPart,
TweenInfo.new(0.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut,0,false,0),
{CFrame = x.HumanoidRootPart.CFrame + (x.HumanoidRootPart.CFrame.LookVector*length - x.HumanoidRootPart.CFrame.LookVector*2)})
CFrameTween:Play()
CFrameTween.Completed:Connect(function()
x.HumanoidRootPart.Anchored = false
end)
end
--call to tween function
remote.OnClientEvent:Connect(function(tweened)
Tween(tweened.Character)
end)
SERVER SCRIPT:
--fires the remote for everyone
remote.OnServerEvent:Connect(function(plr)
Activated()
remote:FireAllClients(plr)
end)
How it looks like (the actual issue):
How it shoud look like (as I said, this looks like only on the respective client when I directly do the tween in a first place):
Thank you for reading!