What do you want to achieve? Leaderstats change for all players in the server.
What is the issue? Leaderstats will only change for the client and not the server.
RunContext is Client
local Prompt = game.workspace.ChefHats.Chef1.ChefHat.ProximityPrompt
local player = game.Players.LocalPlayer
Prompt.Triggered:Connect(function(Player)
local Hats = Player.leaderstats.Hats
Hats.Value += 1
workspace.ChefHats.Chef1:WaitForChild('ChefHat'):Destroy()
end)
—localscript
local re = game.ReplicatedStorage:FindFirstChild(“Remote Event”)
local Prompt = game.workspace.ChefHats.Chef1.ChefHat.ProximityPrompt
Prompt.Triggered:Connect(function(Player)
re:FireServer
workspace.ChefHats.Chef1:WaitForChild('ChefHat'):Destroy()
end)
—script
local re = game.ReplicatedStorage:FindFirstChild(“Remote Event”)
re.OnServerEvent:Connect(function(plr)
local hats = plr.leaderstats.Hats
hats.Value += 1