Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Was there an API change to TweenPosition lately?

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?

  • This is for a surfaceGUI

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.

1 comment

0

Maybe try a local script, I tried to tween a Gui with a script but didn't work then I tried it in a LocalScript and It worked in the real game in the the studio!

1 answer

✓ Accepted answer

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.

3 comments

0

In Studio, by the way, you can almost consider all scripts to be treated as a LocalScript, which explains why some things work in Studio but not online.

0

Even if FE is false you should still handle GUIs on the client, using LocalScripts.

0

Yep! ^

This discussion is preserved as it was. New answers, comments, and votes are closed.