Ad
Log in to vote
0

How do I add numbers to my simple scoreboard?

Asked by 14 days ago

I made a GUI scoreboard in StarterGui and I am having trouble figuring out how to actually make it work lol.

Heres the script:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.E then script.Parent.Text = + 1 end)

Script.Parent is the text label.

1 answer

Log in to vote
1
Answered by 14 days ago

Basically, You can add Number to a Text because thats the rules.

If you want to then you can create a value of Number,

Example:

local Number = 0

(You can do it in ServerScript or LocalScript)

Just like then and you already created a Number inside of a Script.

To make the Text following the Number, you can do it with a script,

Example:

local Number = 0

while wait() do --Looping
    script.Parent.Text = Number
end

Solution:

local Number = 0

while wait() do --Looping
    script.Parent.Text = Number
end

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input) 
    if input.KeyCode == Enum.KeyCode.E then 
        Number += 1 --Add a Value to Number
    end
end)

Notes for You:

  1. (= +) is wrong, the correct one is (+=, No Space)

  2. Write your script with Tools that this site give so we can understand it better

  3. You cant add a Number to a Text

Hope It Helps!

Ad

Answer this question