price = 50
local texthandler = coroutine.create(function()
while wait() do
script.Parent.Text = "UPGRADE BUILDING [Level: "..script.Parent.Parent.Parent.Selected.Value.Level.Value"]"
end
end)
script.Parent.MouseButton1Down:connect(function()
coroutine.resume(texthandler)
print("Test")
local level = script.Parent.Parent.Parent.Selected.Value.Level
if script.Parent.Parent.Parent.Parent.Parent.Gold.Value >= price then
script.Parent.Parent.Parent.Parent.Parent.Gold.Value = script.Parent.Parent.Parent.Parent.Parent.Gold.Value-price
price = price*2
script.Parent.Parent.Parent.Selected.Value.Level.Value = script.Parent.Parent.Parent.Selected.Value.Level.Value+1
end
end)
I've been making this script to upgrade a building by clicking on a TextButton. I've set several breakpoints and prints(), but it seems to not even start working. The script is enabled and there's no mistake that I can find. So what's wrong? Here's the Explorer: http://prntscr.com/9jucl3

3 comments
I would personally connect that function to the Changed event of the Level value.
Thanks a lot. I only had to change it to a LocalScript.
No problem