“Incomplete statement: expected assignment or a function call”
I have no idea why??
Any operations should be after the assignment operator.
It should be:
if (cash.Value > 0) and (cash.Value < price) then
I think its because of this?
price = price - cash.Value
Also the second part doesn’t make sense either and should also probably be
cash.Value = cash.Value - cash.Value
--idk thow why you are trying to subtract the same value thow
Yeah.
Furthermore, you can do
price -= cash.Value
price += cash.Value
You used and
improperly and didn’t put the = in the right place
price = cash.Value - price
I don’t get this part
cash.Value - cash.Value = cash.Value
Are you trying to set cash to 0? What are you trying to do??
The statement you used is broken syntax. From what I see you’re defining the variable “Price” as that before hand. In lua you need to define the variable and then the value
globalVariable = 1 + 1
local localVariable = 1 + 1
For you, I’d say you’ll have to split that into two lines
local price = price - cash.Value
Sorry can’t add more. The website is spamming me saying i’m typing in another tab. But do respond if you need me to explain more!
yes, trying to set cash to 0.
chars
So you could just do cash.Value = 0
So make them different lines, instead of using and
and assigning both values in one line, that’s not how and
is meant to be used.
@SevenDevelopment @AsynchronousMatrix
why tho roblox
trying to make button turn green when thing bought, roblox just doesn’t want to co-operate
Erm roblox isn’t the problem here, try doing this instead
button.BackgroundColor3 = Color3.new(55, 255, 0)
Try replacing,
price - cash.Value = price and cash.Value - cash.Value = cash.Value
with,
cash.Value -= price
basically i want player to have x money and x price and price goes down if they click but dont have enough money
example
kyle has 24 points
price is 250
250-24 points = 226 points which is the new price, kyle loses his money and hes now back at 0 points. I don’t think your code will do that?
^ Watch this pls
For some reason, my tween thing (I have no idea what any of this is, im brand new to scripting and i wrote this today) is not working, and i’d like the bar to be filled up with yelllow depending on how much cost remains of the original price. You can see what i’m talking about in the video, but instead it’s happening with the health bar part.
I’m not sure why, but no color changes? I don’t get an error message, and even though it’s redlined it doesn’t work if it isn’t redlined.
You just have a lot of syntax confused.
Someone here already told you, but, it should be:
button.BackgroundColor3 = Color3.fromRGB(55, 255, 0)
If you go with the Color3.new instead of .fromRGB then you’ll have to do:
button.BackgroundColor3 = Color3.new(55/255, 255/255, 0/255)
A function syntax would be
function(callParameter1, callParameter2)
This is because it’s wrapped with “(…)” hence. “Calling” that “function”
You’re wrapping a Value with theses. Attempting to use it as a function. Which will result in an error.
I’d recommend you look into how syntax works with Lua U and check out some videos by creators such as AlvinBlox. These creators will help you understand how the functions/properties work.
What is happening with the engine is basically. You’re formatting code in a weird way. And it doesn’t like it. Hence an orange line. Not a red line. If It was a red line, It would raise an error accordingly. But since its an understandable instruction it can execute
What you should of done is something like this:
local Color = Color3.fromRGB(0, 0, 0)
local Lerp = Color:lerp(Color3.fromRGB(0, 0, 0), price - cash.Value)
This dosen’t work at all?
i’ve been working on my script for a while, and now the number no longer updates and the color changes, but to a solid yellow and doesn’t transition color based on completion. It doesn’t animate anymore, and if clicked once, it will just be yellow, and if you complete the price purchase by clicking it a final time, that is when it changes to green.
I have no idea what the hell is going on.