-
What do you want to achieve? Keep it simple and clear!
Upgrade button must work properly, and upgrade if value is 1
-
What is the issue? Include screenshots / videos if possible!
Issue is, even if i have 1$ in value, I’m still can’t buy upgrade
Here is screenshot:
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Idk how to fix that. Idk if that possible to find solution on devhub/youtube
Here is script:
--Upgrade button script
local SpeedLevel = script.Parent.Parent.SpeedLevel
local PlayerMoney = script.Parent.Parent.PlayerMoney
if PlayerMoney.Value >= 1 then
if SpeedLevel.Value == 0 then
script.Parent.Touched:Connect(function()
SpeedLevel.Value = SpeedLevel.Value + 1
script.Parent:Destroy()
end)
end
end
Also i figured a problem, when i launch game touchInterest don’t create inside of button, so i can’t touch it, how do i create it inside or fix that?
try using a wait function before the Parent is destroyed
Problem not in this tho, i just can’t touch it, i don’t have touch interest in it
i think your problem could be because in this script youre setting PlayerMoney as script.Parent.Parent.PlayerMoney
but this part of the script (at least im assuming) runs immediately, as it is not part of an event or loop or anything
so, the variable “PlayerMoney” is sent to the initial value of script.Parent.Parent.PlayerMoney
which I assume is 0
meaning it will never be greater than or equal to one
so try removing the variable (just say if script.Parent.Parent.PlayerMoney.Value >= 1 then), that might help (i had a problem with this same thing yesterday lol)
Yeah this is right, on start it’s 0
oh, and if you dont have a touch insert in it, its because
the variable (like i stated in my previous reply) is set to the inital value, 0
you have the if statement and then the touch statement, so, playermoney is not >= 1 (because its 0, the initial value) meaning it never gets to the touched event, meaning it will never add a touch insert
well in that case what just remove the variable and it should work
Oh wait bruh, i forgot i was setting button transparency to 0, but now i clone it from serverstorage, and forgot to change script my fault sorry