Here is the script that works:
local repStore = game:GetService("ReplicatedStorage")
local re4 = repStore:WaitForChild("RemoteEvent4")
local function diamondIncrease(player)
player.leaderstats.Diamonds.Value = player.leaderstats.Diamonds.Value + 100
local character = player.Character
end
re4.OnServerEvent:Connect(diamondIncrease)
Now, here is the code that fails. The only difference is how I reference the value of the diamonds which is a child of the leaderstats folder beneath the player. Note that the event fires on the client side whenever a click is detected in the game.
local repStore = game:GetService("ReplicatedStorage")
local re4 = repStore:WaitForChild("RemoteEvent4")
local function diamondIncrease(player)
local leaderstats = player.leaderstats
local Diamonds = leaderstats:FindFirstChild("Diamonds")
diamondsVal = Diamonds.Value
Diamonds = Diamonds + 100
print("You have this many diamonds.. " .. Diamonds.Value)
end
re4.OnServerEvent:Connect(diamondIncrease)
I appreciate any help. Thanks!

1 comment
I am here to help, please put your formatted code in a code block.