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

so I've been trying to make an accuracy score for a while, but it never works out, how do you do it?

Asked by 2 years ago

so I tried to make it so the accuracy score is calculated by total clicks divided by the number of clicks. 1 miss is - 1 clicks and 1 hit is + 1 click. When they miss the first click the script works. But if they hit the first click then accuracy score just goes to 50 and if you miss other times then it works but if you don't then it'll stay 50. How will I make it work?

this script is if they miss.

`local counter = script.Parent.Parent.Counter1
local clicked = script.Parent.Parent.clickedScoreValue
local clicks = script.Parent.Parent.clicksScoreValue
local Accuracy = script.Parent.Parent.AccuracyScoreValue
local debouce = true
while wait() do
    script.Parent.MouseButton1Click:Connect(function()
        if script.Parent.Parent.PlayButton.Visible == false then
            if debouce == true then
                debouce = false
                clicks.Value = clicks.Value + 1
                clicked.Value = clicked.Value - 1
                local accuracy = math.floor(clicked.Value/clicks.Value * 100 * 0.5) or 0
                Accuracy.Value = accuracy
                counter.Value = counter.Value/1.5
                wait(0.1)
                script.Parent.Parent.HitCounter.Text = counter.Value
                debouce = true

            end
            else
        clicks.Value = 0
            clicked.Value = 0
            Accuracy.Value = 0
        end
    end)
end`

this script is if they hit

`local counter = script.Parent.Parent.Counter1
local debouce = false
local clicked = script.Parent.Parent.clickedScoreValue
local clicks = script.Parent.Parent.clicksScoreValue
local Accuracy = script.Parent.Parent.AccuracyScoreValue
while wait() do
    if script.Parent.Parent.PlayButton.Visible == false then
    script.Parent.Visible = true
        script.Parent.MouseButton1Click:Connect(function()
            if debouce == false then
                debouce = true
                clicked.Value = clicked.Value + 1
                clicks.Value = clicks.Value + 1
                local accuracy = math.floor(clicked.Value/clicks.Value * 100 * 0.5) or 0
                Accuracy.Value = accuracy
                counter.Value = counter.Value + 25
            game.Workspace["clickfast.wav"]:Play()
            script.Parent.Position = UDim2.new(math.clamp(math.random(), 0.2, 0.8), 0, math.clamp(math.random(), 0.2, 0.8), 0)
                script.Parent.Parent.HitCounter.Text = counter.Value
                wait(0.1)
                debouce = false
            end
        end)
    else
        script.Parent.Visible = false
        script.Parent.Parent.HitCounter.Text = ""
        counter.Value = 0
        clicked.Value = 0
        clicks.Value = 0
        Accuracy.Value = 0
    end
end`
0
nvm i got it fixed fire_yusuf 0 — 2y
0
I just removed the clicks value line when you miss. Such an easy fix idk how I didn't release that lol sorry guys fire_yusuf 0 — 2y

Answer this question