Why does this only work from server scripts?

local gui = game:getService("StarterGui"):WaitForChild("Game")
local gameplayPart = Instance.new("Part",workspace)
local bar = gui.Border.Green
local bp = Instance.new("BodyPosition")
bp.Position = Vector3.new(50,0,0)
bp.Parent = gameplayPart

local function changeBarPosition()

bar.Position = UDim2.new(UDim.new(gameplayPart.Position.X/100-.5,0),UDim.new(0,0))

print("hi")

end

changeBarPosition()

It prints, but it doesn’t actually update the position of the bar unless it’s in a server script. Why?

I’m not quite sure what you mean, it’s located on the client and server, the idea was that it changes the position for the client and copies the change also on the client. How could I fix it?

instead of doing this you should get PlayerGui from all players and update that

1 Like

Keep in mind this only updates once, and its updating it from starter gui, not to mention that its using Vector on a gui. It almost definitely won’t work

I would appreciate it if you explain what you are trying to do/