#Getting Sparkles on Head when Reaching 10 Points on Leaderboard

11 messages · Page 1 of 1 (latest)

frank blade
#

leaderstats script:

game.Players.PlayerAdded:Connect(function(player)
    local leaderStats = Instance.new("Folder", player)
    leaderStats.Name = "leaderstats"

    local Points = Instance.new("IntValue", leaderStats)
    Points.Name = "Points"
end)

reward script:

local Players = game:GetService("Players")
local player = Players:GetPlayers()

local function onCharacterAdded(character)
    if not character:FindFirstChild("Sparkles") then
        local sparkles = Instance.new("Sparkles")
        sparkles.Parent = character:WaitForChild("Head")
    end
end

for i, v in pairs(player) do
    if player.leaderstats.Points.Value == 10 then
        v.CharacterAdded:Connect(onCharacterAdded)
    end
end
#

you get points by clicking on a button that is on the map

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local playerPoints = player.leaderstats.Points
    playerPoints.Value = playerPoints.Value + 1
end)
#

the getting points and leaderstats script does work
the problem is
the reward one is not working
also, all of them are in Workspace. leaderstats one is in Workspace, reward is in Workspace, points is in a part of the button that has to get clicked

frank blade
#

found (ig) a way to simplify the reward script:

game.Players.PlayerAdded:Connect(function(player)
    if player.leaderstats.Points.Value == 10 then
        player.CharacterAdded:Connect(function(character)
            if not character:FindFirstChild("Sparkles") then
                local sparkles = Instance.new("Sparkles")
                sparkles.Parent = character:WaitForChild("Head")
            end
        end)
    end
end)
undone steppeBOT
#

studio** You are now Level 1! **studio

frank blade
#

still doesn't work tho

fallen anchor
#

wait i will try to do

#

and is leaderboard working? because u didn't wrote the value

fallen anchor
frank blade