This is the whole script. I'm trying to make a tycoon game. I need the cash value that is displayed above the part to change when the part's cash value gets changed. I just need make the function detect when the cash value has been changed. Or do I have to do a loop to make sure it always see the cash value. Meaning a while loop to alway check the cash value so, when the cash value changes, the cash display also changes to whatever the cash value is.. Any help will be appreciated! Ty
wait(2)
workspace:WaitForChild("PartStorage")
deb = true
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
if deb == true then
deb = false
local part = Instance.new("Part",workspace.PartStorage)
local cash = Instance.new("StringValue",part)
local upgrade = Instance.new("StringValue",part)
local board = Instance.new("BillboardGui",part)
local text = Instance.new("TextBox",board)
part.BrickColor = BrickColor.new("Medium stone grey")
cash.Name = "Cash"
cash.Value = 1
upgrade.Name = "Tags"
upgrade.Value = 0
board.Size = UDim2.new(0,75,0,25)
board.StudsOffset = Vector3.new(0,1.5,0)
board.MaxDistance = 30
text.Size = UDim2.new(0,75,0,25)
text.TextXAlignment = "Center"
text.TextYAlignment = "Center"
text.Font = "Legacy"
text.TextSize = 20
text.BackgroundTransparency = 1
text.Text = "$"..cash.Value
part.CFrame = script.Parent.Drop1.CFrame - Vector3.new(0,1.3,0)
part.Size = Vector3.new(1, 1, 1) -- Size of the drops
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
game.Debris:AddItem(part,20) -- How long until the drops expire
wait(0.35)
deb = true
cash.Value.Changed:connect(function(changedd)
changedd.Cash.Value = "$"..cash.Value
end)
end
end)
``
