Ok, so... I'm trying to make a system to make that when the player has triggered a prompt, it will add some points to the player and show up in the leaderstats, but... for some reason doesn't work... please help me... I would thank the person who help me with this stuff.
The prompt local script:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local prompt = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")
local remotesEvents = replicatedStorage:WaitForChild("RemotesEvents")
local addDevPointsEvent = remotesEvents:WaitForChild("AddDevPoints")
prompt.Triggered:Connect(function()
addDevPointsEvent:FireServer(player)
end)
And the main server script:
local replicatedStorage = game:GetService("ReplicatedStorage")
local remotesEvents = replicatedStorage:WaitForChild("RemotesEvents")
local addDevPointsEvent = remotesEvents:WaitForChild("AddDevPoints")
local function PlayerSetup(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local devPoints = Instance.new("IntValue", leaderstats)
devPoints.Name = "DevPoints"
devPoints.Value = 0
local funds = Instance.new("IntValue", leaderstats)
funds.Name = "Funds"
funds.Value = 0
end
game.Players.PlayerAdded:Connect(PlayerSetup)
addDevPointsEvent.OnServerEvent:Connect(function(player)
player.leaderstats.DevPoints.Value = player.leaderstats.DevPoints.Value + 2
end)

6 comments
I see that you avoided using the second argument of Instance.new. You're correct in setting the Parent property last, but you're missing one extra, vital step: the instance should not be parented until it and its descendants have been configured. You're still deploying the leaderstats folder too early as children still need to be added to it. For leaderstats, it's ultimately best to prefabrica
interstng thanks
Nop sorry, didn't work
can u post the error & and the current script along with your explorer? the script is working for me, we cant help u without any information
No errors
I'm using a LOCAL SCRIPT inside the prompt, read the local script, I'm using a remote event