Rewarder script not working in SSS (strength leaderstat: NumberValue)

Hello there! I am trying to find out what is wrong with my rewarder script wich is in SSS and its supposed to give you 750 strength (a number value) but it does not work when you type a code in called “TEST” it says the strength code is true but it does not give the actual strength here is the script!

game.ReplicatedStorage.Rewarder.OnServerEvent:Connect(function(player, strength)
player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + strength
end)

i have tried looking for some tutorials on youtube and i did not find anything that helps.

if you need the leaderstats script just comment and ill show you it and the local script inside of the codes gui!

1 Like

Can we see what fires this event?

local player = game.Players.LocalPlayer

script.Parent.Textinput.FocusLost:Connect(function()
print(“Focus lost”)
if script.Parent.Textinput.Text == “TEST” then
print(“StrengthCode true”)
if player.StrengthCode.Value == false then
print(“StrengthCode is false”)
local Strength = 750
game.ReplicatedStorage.Rewarder:FireServer(Strength)
player.StrengthCode.Value = true
end
end
end)
if player.StrengthCode == false then
print(“The code is invalid!”)
end

script.Parent.Exit.MouseButton1Click:Connect(function()
script.Parent.Visible = false
end)

script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
script.Parent.Visible = true
end)

The only way this wouldn’t fire is if strengthCode is true. Does it print “StrengthCode is false”?

It does not print “StrengthCode is false”

Alright so the default value of StrengthCode is probably set to true. Set it to false or uncheck it.

So you mean where the leaderstats is? So its something like this:

local Strength = Instance.new("NumberValue")
Strength.Name = "Strength"
Strength.Parent = leaderstats

local StrengthCode = Instance.new("NumberValue")
StrengthCode.Value = false
StrengthCode.Parent = player
StrengthCode.Name = "StrengthCode"

Yeah have it initially set to false.

Where do you mean to “initially set to false”?

What you did is correct. What I meant was do StrengthCode.Value = false when you create StrengthCode.

when you create StrengthCode.
I am a really new scripter and understand a little bit of things but not quite what you mean by that?

local StrengthCode = Instance.new("NumberValue")
StrengthCode.Value = false
StrengthCode.Parent = player
StrengthCode.Name = "StrengthCode"

What you did is correct.

Yeah so what is wrong with the script?

Nothing is wrong with that script.

I changed the LocalScript to false:
local player = game.Players.LocalPlayer

script.Parent.Textinput.FocusLost:Connect(function()
print(“Focus lost”)
if script.Parent.Textinput.Text == “TEST” then
print(“StrengthCode true”)
if player.StrengthCode.Value == false then
print(“StrengthCode is false”)
local Strength = 750
game.ReplicatedStorage.Rewarder:FireServer(Strength)
—> player.StrengthCode.Value = false
end

Does it print “StrengthCode true”?

It does print “StrengthCode true”

Are there any errors after that?

It prints “FocusLost” and “StrengthCode true”