Still have questions? Join our Discord server and get real time help.
Log in to vote

Points not given to my user only (points aren't given to me and only me) ?

Asked by 6 days ago

I made a Points System for a cafe, when I tried to test it, I gave a tool to the owner and it worked but I didn't get a point, but then she gave me a tool and she got a point.

When I searched for the problem in the studio, I found a player in the players folder, the player had my name, I wasn't running the game in the studio, and it can't be removed, I am not sure how to fix it.

This is the Points System script:

local DataStoreService = game:GetService("DataStoreService")
local PointsStore = DataStoreService:GetDataStore("PointsStore")

    local SavedPoints = PointsStore:GetAsync(Player.UserId)

    local Leaderstats ="Folder", Player)
    Leaderstats.Name = "leaderstats"

    local PointsValue ="IntValue", Leaderstats)
    PointsValue.Name = "Points"

    if SavedPoints ~= nil then
        PointsValue.Value = SavedPoints

        PointsStore:SetAsync(Player.UserId, NewPoints)

This is the GiveItem script:

game.ReplicatedStorage.GivePlayerItem.OnServerEvent:Connect(function(Player, PlayerName)
    if Player.Name ~= PlayerName then
        local ToolToGive = Player.Character:FindFirstChildWhichIsA("Tool")
        ToolToGive.Parent = game.Players[PlayerName].Backpack
        Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1

Any help would be greatly appreciated.

Answer this question