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

Other ways to get a up to date leaderstats variable?

Asked by 4 years ago

The problem i am facing is when I fire the event, the script will not work, this is down to the arguments I am passing, I am giving the value of the players spins, this is working up until the point where I need to add to the value, where it will stop, I don't know any other way i could get around this though, If anyone knows anything please help me out, thanks!

The fire script:

local t = true

script.Parent.Activated:Connect(function()
    if t == true then
    game.ReplicatedStorage.addevent:FireServer(game.Players.LocalPlayer.playerstats.addition.Value, game.Players.LocalPlayer.playerstats.multiplier.Value, game.Players.LocalPlayer.playerstats.MaxValue.Value, game.Players.LocalPlayer.leaderstats.Spins.Value)
    print("Fired")
end
end)


script.Parent.Activated:Connect(function()
    if t == true then wait(.0001)
         t = false
        wait(1)
        t = true

    end
end)

The receiving script (in server script service)


game.ReplicatedStorage.addevent.OnServerEvent:Connect(function(plr, add, multiply, max, spin) print(add) print(multiply) print(max) local gamepass = 8784518 local service = game:GetService("MarketplaceService") if spin < max and service:UserOwnsGamePassAsync(plr.UserId, gamepass) then spin = spin + add*multiply*2 print("DoublePass Pay!") if spin > max then spin = max elseif spin > max then spin = max elseif service:UserOwnsGamePassAsync(plr.UserId, gamepass) == false then if spin < max then spin = spin + add*multiply print("Normal Pay") if spin > max then spin = max end end end end end)

Answer this question