Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I tween a gui inside of a server script?

Asked by 4 years ago

Hey! I'm trying to make a gui where when the value "OnScreen" is true, the gui tweens to a position. The problem is is that the tweenposition is inside of a server script and I'm not sure how to tween it outside of a localscript. Here's my code that I'm working with:

local tweenService = game:GetService("TweenService")
local TextLabel = game.StarterGui.ScreenGui:WaitForChild("TextLabel")
local OnScreen = game.ServerStorage:WaitForChild("OnScreen")
OnScreen.Value = false



OnScreen.Changed:Connect(function()
    if OnScreen.Value == false then
        TextLabel:TweenPosition(UDim2.new(0.183, 0,1, 0))
    elseif OnScreen.Value == true then
        TextLabel:TweenPosition(UDim2.new(0.183, 0,0.8, 0))
    end
end)

wait(3)
OnScreen.Value = true

wait(3)
OnScreen.Value = false

If somebody could help me that would be greatly appreciated. Thanks!

Answer this question