(Solved) Need help with IntValue

i have 2 pieces of code. 1 to keep track and add packages. 1 to show the package amount
Code 1 (keep track)

local _1 = script.Parent.Parent.Parent.Color1
local _2 = script.Parent.Parent.Parent.color2
local _3 = script.Parent.Parent.Parent.color3
local sound = workspace.SoundLibrary.Package_Open
local packages = game.ServerStorage.packages
script.Parent.Triggered:Connect(function()
	
	packages.Value += 1
	_1.Transparency = 0
	_1.CanCollide = true
	_2.Transparency = 0
	_2.CanCollide = true
	_3.Transparency = 0
	_3.CanCollide = true
	sound:Play()
	script.Parent:Destroy()
end)

code 2 (gui code)

while wait() do
	script.Parent.Text = game.ServerStorage.packages
end

Images:
image

image
please help me.

What exactly do you need help with? You can’t just show us code and expect us to know – you need to identify an issue.

Sorry lol. The int value is going up yet the gui code isn’t keeping track of it at all in the textlabel.

1 Like

This is going to throw an error:

while wait() do
	script.Parent.Text = game.ServerStorage.packages
end

game.ServerStorage.packages is a ValueObject, and thus you need to get its value by using game.ServerStorage.packages.Value. Additionally, you will have to convert the number to a string (this is not necessary for integer values, however, so you can omit the tostring() if you really want to.

while wait() do
	script.Parent.Text = game.ServerStorage.packages.Value
end
1 Like

Thanks. I’m new to programming, so a lot of my stuff is buggy.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.