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

[solved] Why isn't this changing a leaderstat? What have I done wrong?

Asked by 3 years ago
Edited 3 years ago

This question has been solved by the original poster.

Server script inside of serverscriptservice:

game.Players.PlayerAdded:Connect(function(plr)
    game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
        if plr.leaderstats.Memory.Value > 100 then
            plr.leaderstats.Memory.Value = plr.leaderstats.Memory.Value - 100
            plr.leaderstats.Deletes.Value = plr.leaderstats.Deletes.Value + 10
        end
    end)
end)

Local script in a textbutton:

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer()
end)

Output: No errors

What have I done wrong? (Yes, there is a remoteevent in replicatedstorage.)

1 answer

Log in to vote
0
Answered by 3 years ago

Solved myself

Ad

Answer this question