Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Boolean based character design system does not work?

Asked by 6 years ago

Ok basicly i'm creating a game that has a customisation feature, I want users to be able to outfit their characters and only be able to choose one item at a time. I want this to add to a "Total price" i have included a screen shot so you get the general idea

https://gyazo.com/b55da258104fe4baf7eba969473e9160

When they click an item it replaces the item on the right, I've managed to do this visually. But i would like the items

3rd Item in the box.

01LA1 = script.Parent.Parent.Parent.LegButton.LA1
02LA2 = script.Parent.Parent.Parent.LegButton.LA2
03LA3 = script.Parent.Parent.Parent.LegButton.LA3
04placeholder = script.Parent.Parent.Parent.LegButton.placeholder
05LA1Value = script.Parent.Parent.Parent.Parent.OutfitPriceFrame.totalPrice.LA1
06LA2Value = script.Parent.Parent.Parent.Parent.OutfitPriceFrame.totalPrice.LA2
07LA3Value = script.Parent.Parent.Parent.Parent.OutfitPriceFrame.totalPrice.LA3
08 
09 
10 
11script.Parent.MouseButton1Click:connect (function ()
12 
13playername = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
14player = Workspace:FindFirstChild(""..playername.."")
15if player ~= nil then
View all 31 lines...

Now i want the LAValue's to change a separate intbool value which i have attached a screenshot of

https://gyazo.com/ffa76b15135d290383958da3c7649f59

But the boolean values don't change when i try them in testing. This next script is supposed to add one value to a VALUE int

01LA1 = script.Parent.LA1.Value
02LA2 = script.Parent.LA2.Value
03LA3 = script.Parent.LA3.Value
04 
05while true do
06 
07if script.Parent.LA1.value == true then
08 
09    script.Parent.TOTAL.Value = script.Parent.TOTAL.Value + 130
10else
11    script.Parent.TOTAL.Value = 0
12end
13if script.Parent.LA2.Value == true then
14    script.Parent.TOTAL.Value = script.Parent.TOTAL.Value + 190
15else
View all 23 lines...

And then this last bit of code is supposed to display on the text label but it just breaks, I have tried work arounds. but with no luck. Any help and advice would be great.

1game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.TOTAL.Changed (function()
2    script.Parent.Parent.totalPrice.Text = script.Parent.TOTAL.Value
3end)   

I'm very new to LUA but i know a few minor coding languages.

0
Could you explain what you mean by "it just breaks" nick540 20 — 6y
0
Yes sorry, It displays this message https://gyazo.com/5c14002cea2ea0fe112064116e8fddd7 WorldEngine 2 — 6y
0
you forgot the connect the event with the function User#23365 30 — 6y
0
Still did the same thing WorldEngine 2 — 6y
View all comments (5 more)
0
The main issue is the boolean refuses to change button is clicked WorldEngine 2 — 6y
0
That error message pops up usually when you have a loop without a wait(). Look at the 2nd code block where the 'while true do' is and put in a wait() somewhere inside it. xPolarium 1388 — 6y
0
Lua is not an acronym and should not be spelt as one. It is spelt "Lua" and not "LUA". For the sake of readability and for respect. User#19524 175 — 6y
0
As i said i'm new to the language my previous languages are HTML, CSS, JS Which are all acronyms. But thanks for your incisive comment. WorldEngine 2 — 6y

Answer this question