So I want the variable "Upgrades" to be the value of the leaderstats I have name "Upgrades" How would I do that?
local Upgrades = 1 game.ReplicatedStorage.anything.OnServerEvent:Connect(function(player) player.leaderstats.Blocks.Value = player.leaderstats.Blocks.Value + Upgrades end)
You can create an attribute.
game.ReplicatedStorage.anything.OnServerEvent:Connect(function(player) local leaderstats = player:WaitForChild("leaderstats") local Upgrades = leaderstats:GetAttribute("Upgrades") if not Upgrades then -- if the attribute wasn't created yet leaderstats:SetAttribute("Upgrades", 1) -- creates the attribute Upgrades = 1 -- defines Upgrades as 1 (default) end leaderstats:WaitForChild("Blocks").Value += Upgrades end)