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

Why wont my Time subtraction handler work?

Asked by 3 years ago
Edited 3 years ago

I have 2 scripts the first one is a local script inside of a ScreenGUI and the other is a ServerScript that's inside the ServerScript service all the local script does is handle my GUI and sometimes fire events. The ServerScript handlers the entire Time system(It isn't really like a countdown more like a value that determines the length of time in the wait() function.) This is the TimeHandler

SubtractTimeEvent.OnServerEvent:Connect(function(player).
    local PlayerGui = player:WaitForChild("PlayerGui") --everything after this doesn't work.
    if player.leaderstats.Bux.Value >= player.leaderstats.OtherStats.CaseSpeedCost.Value then
        player.leaderstats.OtherStats.CaseSpeed.Value -=.5
        player.leaderstats.Bux.Value -=player.leaderstats.OtherStats.CaseSpeedCost.Value
        player.leaderstats.OtherStats.CaseSpeedCost.Value +=2500
        print("Cost Updated.") --everything before this doesn't work.
    end
end)

This is the part of the local script that fires the event to activate the TimeHandler(CaseSpeed is a value that got collected by a local function,)

UpgradeTimeButton1.MouseButton1Click:Connect(function()
    if CaseSpeed.Value <= 2.5 then
        CaseSpeed.Value = 2.5
        UpgradeTimeButton1.Text = "MAXED"
    elseif CaseSpeed.Value >= 2.5 then
        SubtractTimeEvent:FireServer()
    end
    ClickSound:Play()
end)

1 answer

Log in to vote
0
Answered by 3 years ago

You shouldn't depend on a syntax feature that isn't supported with Lua's 5.1 Roblox has really been testing the features but -=, += & etc. can be really faulty.

0
so should I do something like "player.leaderstats.OtherStats.CaseSpeed.Value = player.leaderstats.OtherStats.CaseSpeed.Value = .5"? vincentthecat1 199 — 3y
0
CaseSpeed.Value = CaseSpeed.Value - 0.5 TheLuminent 1204 — 3y
Ad

Answer this question