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 5 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.


LA1 = script.Parent.Parent.Parent.LegButton.LA1 LA2 = script.Parent.Parent.Parent.LegButton.LA2 LA3 = script.Parent.Parent.Parent.LegButton.LA3 placeholder = script.Parent.Parent.Parent.LegButton.placeholder LA1Value = script.Parent.Parent.Parent.Parent.OutfitPriceFrame.totalPrice.LA1 LA2Value = script.Parent.Parent.Parent.Parent.OutfitPriceFrame.totalPrice.LA2 LA3Value = script.Parent.Parent.Parent.Parent.OutfitPriceFrame.totalPrice.LA3 script.Parent.MouseButton1Click:connect (function () playername = script.Parent.Parent.Parent.Parent.Parent.Parent.Name player = Workspace:FindFirstChild(""..playername.."") if player ~= nil then player:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=479112778" end end) script.Parent.MouseButton1Click:connect (function () LA2.Visible = false LA1.Visible = false LA3.Visible = true LA2Value.Value = false LA2Value.Value = false LA3Value.Value = true placeholder.Visible = false end)

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

LA1 = script.Parent.LA1.Value
LA2 = script.Parent.LA2.Value
LA3 = script.Parent.LA3.Value

while true do 

if script.Parent.LA1.value == true then

    script.Parent.TOTAL.Value = script.Parent.TOTAL.Value + 130
else
    script.Parent.TOTAL.Value = 0 
end
if script.Parent.LA2.Value == true then
    script.Parent.TOTAL.Value = script.Parent.TOTAL.Value + 190
else
    script.Parent.TOTAL.Value = 0 
end
if script.Parent.LA3.Value == true then
    script.Parent.TOTAL.Value = script.Parent.TOTAL.Value + 220
else
    script.Parent.TOTAL.Value = 0
end
end

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.


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

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 — 5y
0
Yes sorry, It displays this message https://gyazo.com/5c14002cea2ea0fe112064116e8fddd7 WorldEngine 2 — 5y
0
you forgot the connect the event with the function User#23365 30 — 5y
0
Still did the same thing WorldEngine 2 — 5y
View all comments (5 more)
0
The main issue is the boolean refuses to change button is clicked WorldEngine 2 — 5y
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 — 5y
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 — 5y
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 — 5y

Answer this question