I've been having an issue with TweenPosition lately. I can't figure out the problem on why it will not work correctly anymore. It works in a 2 player test server in Studio but not online. This issue came up yesterday. This script is not a local script. Game has FE enabled.
Was it an API change maybe?
Script:
local P = script.Parent local lights = P.Parent.Lights:GetChildren() local enabled = true local slider = P.Mount.GUI.BG.Body.SliderBG.Slider local title = P.Mount.GUI.BG.Header.Content title.Text = script.Subject.Value..": OFF" local event = script.SwitchEvent function Enable() enabled = true slider:TweenPosition(UDim2.new(0.5, 0, 0, 0), "Out", "Quart", 0.5, true) wait(0.25) title.Text = script.Subject.Value..": ON" title.TextColor3 = Color3.new(0,0.5,0) workspace.EnergyManager.Variables.Usage.Value = workspace.EnergyManager.Variables.Usage.Value + 200 slider.BackgroundColor3 = Color3.new(0,0.5,0) for i = 1, #lights do lights[i].Lamp.Light.Enabled = true wait(0.1) end end function Disable() enabled = false slider:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Quart", 0.5, true) wait(0.25) title.Text = script.Subject.Value..": OFF" workspace.EnergyManager.Variables.Usage.Value = workspace.EnergyManager.Variables.Usage.Value - 200 title.TextColor3 = Color3.new(0.5,0,0) slider.BackgroundColor3 = Color3.new(0.5,0,0) for i = 1, #lights do lights[i].Lamp.Light.Enabled = false end end function PowerCheck() local power = _G.IsPowerOn() if (power) then slider.Parent.Visible = true if (enabled) then title.Text = script.Subject.Value..": ON" title.TextColor3 = Color3.new(0,0.5,0) slider.BackgroundColor3 = Color3.new(0,0.5,0) else title.Text = script.Subject.Value..": OFF" title.TextColor3 = Color3.new(0.5,0,0) slider.BackgroundColor3 = Color3.new(0.5,0,0) end else title.Text = "No power" title.TextColor3 = Color3.new(0.5,0,0) slider.Parent.Visible = false if (enabled) then Disable() end end end event.OnServerEvent:connect(function() P.Mount.Sound:Play() if (enabled) then Disable() else Enable() end end) -- Post init and main loop Disable() while not pcall(function()_G.IsPowerOn() end) do wait() end while wait(0.5) do PowerCheck() end
Any reason why it could not working anymore? It was working as of 2 days ago.
If FilteringEnabled is enabled, you should always use LocalScripts when dealing with GUIs and client-related things. Tamper with LocalScripts and your code to get it to work.
Because this issue isn't something wrong with your code, I see no reason to re-post it and not change it. If you have any questions regarding how to update your code, though, post it in the comments on this reply.