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

TweenSize a Knowledge bar?

So. i am making a knowledge bar and i cant seem why this is giving me an error with TweenSizeing so like if the value is at "50" then the half bar is going to be like a yellow bar the knowledge bar but cant seem why i am getting this error with this script.

Here's the current script.

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
local KnowLedgeBar = script.Parent.KnowLedgeInfo
local player = game.Players.LocalPlayer
local HealthMath = KnowLedgeBar.Value / (KnowLedgeBar.Value)

script.Parent:TweenSize(UDim2.new(HealthMath, 0, 1, 0), "Out", "Sine", .5)

KnowLedgeBar.Value:connect(function()
	local HealthMath = KnowLedgeBar.Value / (KnowLedgeBar.Value)
	script.Parent:TweenSize(UDim2.new(HealthMath, 0, 1, 0), "Out", "Sine", .5)
end)

Here's the current error im getting

15:58:44.710 - Players.ObStactionD3stroy3r.PlayerGui.KnowLegde.Background.KnowLedgeBar.LocalScript:8: attempt to index field 'Value' (a number value)
15:58:44.710 - Stack Begin
15:58:44.711 - Script 'Players.ObStactionD3stroy3r.PlayerGui.KnowLegde.Background.KnowLedgeBar.LocalScript', Line 8

1 answer

Your syntax is just a little off - rather than KnowLedgeBar.Value:connect(func) use KnowLedgeBar.Changed:connect(func). Sorry for the terrible formatting of the answer, I'm on mobile xD

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