[SOLVED] Tween doesn't work on client, but only does on server

I have a tween running that makes a model circle around a bunch of parts - but when it runs on the client, it doesn’t work. The intention is for this to only work on the client.


This is how it runs on the server, on the client, he just stays completely still.
The LocalScript is parented to StarterGui, figured I should make that clear - it’s not a wrong parent as far as I’m aware.

local part = workspace:WaitForChild("Freddy")
local TweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Linear)
local current
local partTable = workspace.WalkPoints:GetChildren()

chosenRandomPosition = partTable[math.random(1, #partTable)]
part.PrimaryPart.CFrame = chosenRandomPosition.CFrame
currentPos = chosenRandomPosition

while true do
	local nextArea = currentPos.Left.Value
	local tween = TweenService:Create(part.PrimaryPart, tweenInfo, {
		Position = workspace.WalkPoints:FindFirstChild(nextArea).Position
	})
	tween:Play()
	tween.Completed:Wait()
	currentPos = workspace.WalkPoints:FindFirstChild(nextArea)
	task.wait(1)
end

image

This is what the WalkPoints folder is, it basically pulls a string and moves to that direction, except, it should move it on the client - but it does only on the server.

Any help would be much appreciated - I’m just, really confused as to why it doesn’t work on the client, yet it does on the server.

EDIT: Any other TweenService script seems to run completely fine, I used prints and it returns values just fine, the only issue is just, this specific tween not running whatsoever.

1 Like

Where did you place the script?

1 Like

I have placed it within StarterGUI - is that an issue?

Can you show where you have it in startergui?

1 Like

image
Just this pretty much.

can you put a print in the loop to make sure its getting to your loop and the loop is running?

1 Like

image
Done that - it just doesn’t seem to, actually tween.

Is it a complete copy of the code that worked on the server? Such as you just made a local script and copied and pasted the code straight from the server script?

1 Like

The exact same script, no differences.

What is in the Left.Value
is it a name, a number or an instance

1 Like

A string - it finds another part within the table of walk points, it will then grab it’s position, move there, and find the left value in there, and continue to loop from there.

Something I’ve just noticed is that, the position changes - it just isn’t, shown.
I used a print to detect the model’s position changing, and it apparently DOES move around, just, the model doesn’t move around in actual viewing?

try this
image

local part = workspace:WaitForChild("Freddy")
local TweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Linear)
local partTable = workspace.WalkPoints:GetChildren()

chosenRandomPosition = partTable[math.random(1, #partTable)]
part.PrimaryPart.CFrame = chosenRandomPosition.CFrame
currentPos = chosenRandomPosition

while true do
	local nextArea = currentPos.Left.Value
	local tween = TweenService:Create(part.PrimaryPart, tweenInfo, {
		CFrame = workspace.WalkPoints:FindFirstChild(nextArea).CFrame
	})
	tween:Play()
	tween.Completed:Wait()
	currentPos = workspace.WalkPoints:FindFirstChild(nextArea)
	task.wait(1)
end


1 Like

This seems to work - thank you so much.

No problem, sorry it took so long for me to duplicate it in studio. I turned out to be that you needed CFrame instead of Position.

1 Like

I’ve seemed to mark it as solved, sorry if this isn’t how you do it.
Thank you for your patience and help though, it means a whole lot to me.

No, my bad, it was lag I guess, it finally popped up just before you replied XD. I was over eager :stuck_out_tongue:

1 Like