Here are the leaderstats in ServerScriptStorage
game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = plr
local Bux = Instance.new("IntValue")
Bux.Parent = stats
Bux.Name = "Bux"
Bux.Value = 0
end)
Here is the script in StarterPack
script.Parent.Equipped:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer()
end)
And here is the script also in ServerScriptStorage
local player = game.Players.LocalPlayer
game.ReplicatedStorage.RemoteEvent:FireClient(function()
player.leaderstats.Bux.Value = 100
end)
Error is Unable to cast value to Object
