#tweens broken on client but working on server

1 messages · Page 1 of 1 (latest)

sacred harness
#

tween working on server script but not on local script

in the .rbxl file is:
a local script under ReplicatedFirst
a server script under ServerScriptService
2 position parts in workspace
and the model inside ReplicatedStorage

both the localscript and the serverscript are exactly the same (except the 'WaitForChild()' and characteradded() functions inside the localscript)
BUT only the serverscript runs the tween correctly.

to test:
run the game with localscript enabled and serverscript disabled: broken tween.
run the game again but with localscript disabled and serverscript enabled: working tween.

What am i doing wrong here please any help would be awesome.

frozen temple
#

virus

sacred harness
#

i literally separated the issue into its own file because it was messy inside my actual game and couldn't tell if i had made an error somewhere.

#

dude you can run the file offline if you;re worried... and nothing will execute unless you RUN the game

frozen temple
#

detected

sacred harness
#

what?

#

its not a virus

frozen temple
#

im jk

sacred harness
#

look i can send the code but theyre basically exactly the same ill send screenshots

frozen temple
#

im kidding

sacred harness
#

i know but i still understand. i wouldnt download a random file out of fear so ill send the code and screenshots anyways

#
--LocalScript
local rs = game:GetService("ReplicatedStorage")
local ts = game:GetService("TweenService")
local plr = game.Players.LocalPlayer

plr.CharacterAdded:Connect(function()
    task.wait(5)
    local part = workspace:WaitForChild("Part")
    local part1 = workspace:WaitForChild("Part1")
    local butterfly = rs.Butterfly.parts:Clone()
    butterfly:PivotTo(CFrame.new(part.Position))
    butterfly.Parent = workspace
    
    butterfly.Skin.CFrame = CFrame.lookAt(butterfly.Skin.Position, part1.Position)
    local tween = ts:Create(butterfly.Skin, TweenInfo.new(8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Position = part1.Position})
    tween:Play()
    
end)
--ServerScript
local rs = game:GetService("ReplicatedStorage")
local ts = game:GetService("TweenService")
local plr = game.Players.LocalPlayer --mistake when copying code - this not required

task.wait(5)
local part = workspace.Part
local part1 = workspace.Part1
local butterfly = rs.Butterfly.parts:Clone()
butterfly:PivotTo(CFrame.new(part.Position))
butterfly.Parent = workspace

butterfly.Skin.CFrame = CFrame.lookAt(butterfly.Skin.Position, part1.Position)
local tween = ts:Create(butterfly.Skin, TweenInfo.new(8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Position = part1.Position})
tween:Play()
#

Server script active - the whole model tweens perfectly fine

#

Local script active - only the anchored part tweens leaving the welded parts (unanchored) in original spot

rigid pond
#

in other words when you do this on the client you're just changing your view of that one part, whereas on the server the change is "real" and effects physics based things like welds

sacred harness
#

Well how do I make it more performance?

#

Performant

#

If I run it on the server it will lag wouldn't it?

rigid pond
#

depends on what the goal is

sacred harness
#

It's just a visual thing nothing needs to be on the server

#

It's a butterfly so it just needs to kinda fly around the place

#

I'm no good at making AI or using motor animations

rigid pond
#

You could make it a mesh in blender then tween it

sacred harness
#

I would but I'm not sure how to make only the wings neon

#

I've heard of vertex shaders that can help with neons

rigid pond
#

you could prob just rig and animate it as a cheap fix

sacred harness
#

Vertex paint**

rigid pond
#

or pivotto every frame depending on how complex the movement is

sacred harness
#

I know of something called :lerp()

#

Which is pivotto but a step towards a position each time you just use it under run service:renderstep

#

And it basically acts as a linear tween

#

But I was hoping tween would just work

#

Brb

#

Any other ideas would help or how do other games make random butterfly ais

#

AI's

rigid pond
#

yeah you can interpolate if it works

sacred harness
#

im going to use lerp() it will work fine thankyou for letting me know that welds are server authoritative physics objects that pretty much answered my question.

foggy charm
lost sluice