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

How do you make a calculator screen GUI?

Asked by 9 years ago

I have made a screen GUI that looks like this:

Enter Total here(Textbox) Enter(TextButton) Total(TextLabel)

I want that when you press enter it multiplies your number in enter total here by 0.13 and then print the answer in Total. I am very new to scripting and am not very sure where to start. I don't know how to reference variables and numbers yet.(Don't laugh at me :p)Am I on the right path?

(The GUI is called CashierGUI) Here is a copy of my script:

connect:game.Workspace.StarterGUI.CashierGUI.Enter(function() if Enter.MouseButton1click:connect(function()=true then (Answer) *0.13 draw.Total

end)

end)

1 answer

Log in to vote
0
Answered by
Uroxus 350 Moderation Voter
9 years ago

For starters it's helpful if you have the whole section of code within a code block - rather than just one line.

Secondly, you'll need to detect what key has been pressed. More information about that can be found here

The line;

connect:game.Workspace.StarterGUI.CashierGUI.Enter(function()

is full of mistakes. The connect:comes after your 'declaration'. Also game.Workspace.StarterGUI would do absolutley nothing as the StarterGUI is not actually located within Workspace - It's located within game. So would just be game.StarterGUI.CashierGUI

I'd suggest trying some more basic scripting with some GUIs like changing the text of one with a script, and then work on KeyDown and once you've got both of them stick them together to form what you want.

Ad

Answer this question