Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I don't know where to put my updating points every second script should go, can you help?

Asked by 3 years ago

Hi there! I'm making a game where the players' points update by one every second. I need the points to start updating only when the player steps on a model and reset back to 0 when the player dies. The model is called "Game." This script should work, but I have NO idea where to put it. Can you tell me?

local Players = game:GetService("Players")
    local UpdatePoints = false
    local function onTouch(part)
        return end
    end
    part.Touched:Connect(onTouch) 
    Players.PlayerAdded:Connect(function(Player)   
            Player.CharacterAdded:Connect(function(Character)
                    UpdatePoints = true

                    local Leaderstats = Instance.new("Folder")
                    Leaderstats.Name = "leaderstats"
                    Leaderstats.Parent = Player

                    local Points = Instance.new("IntValue")
                    Points.Name = "Points"
                    Points.Parent = Leaderstats

                    Player.leaderstats.Points.Value = 0

                    local Humanoid = Character.Humanoid
                Humanoid.Died:Connect(function()
                            UpdatePoints = false
                            Player.leaderstats.Points.Value = 0
                    end)

                    while (UpdatePoints) do
                            wait(1)
                        Player.leaderstats.Points.Value += 1
                            if not (UpdatePoints) then
                                    break
                            end
                        end
                end)
end)
0
SSS acediamondn123 147 — 3y
0
ServerSCriptService :) bc why not :>>>>>> acediamondn123 147 — 3y
0
oh wait acediamondn123 147 — 3y
0
are ytou telling me where to put the adding thing? acediamondn123 147 — 3y

Answer this question