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

Points Service :/ Please Help?

Asked by 9 years ago

Im not completely sure if this will work as I am a Beginner Scripter and Im still learning :/

local roundtime = 60 * 5
local intermissiontime = 20

--Variables
local marketservice = game:GetService("MarketplaceService")
local datastore = game:GetService("DataStoreService"):GetDataStore("PointsData")
local serverstorage = game:GetService("ServerStorage")
local replicatedstorage = game:GetService("ReplicatedStorage")
local debris = game:GetService("Debris")
local event = replicatedstorage:WaitForChild("RemoteEvent")
local maps = serverstorage:WaitForChild("Maps")
local mapholder = game.Workspace:WaitForChild("MapHolder")
local statustag = replicatedstorage:WaitForChild("StatusTag")
local timertag = replicatedstorage:WaitForChild("TimerTag")
-- Actual Script
function awardwin(player)
    if player then
        local mydata = playerdata[player.userId]
        local leaderstats = player:FindFirstChild("leaderstats")
        if leaderstats and mydata then
            mydata.wins = (mydata.wins or 0) + 1

            local winsvalue = leaderstats:FindFirstChild("Wins")
            if winsvalue then
                winsvalue.Value = mydata.wins
                points = game:GetService("PointsService")
                getPoints = points:GetAwardablePoints()
                if getPoints >= 100 then
                    points:AwardPoints(player.userId, winsvalue.Value)
                end
            end
        end
    end
end

Output: 19:30:30.230 - Place has to be opened with Edit button to access DataStores 19:30:30.521 - ServerScriptService.MainScript:147: attempt to index upvalue 'datastore' (a nil value)

0
What exactly is your question? wrenzh 65 — 9y

1 answer

Log in to vote
0
Answered by
noliCAIKS 210 Moderation Voter
9 years ago

I am not very experienced with DataStores, but judging from the output, I think you should try opening your place with the edit button, opening the command bar (View -> ToolBars -> Command) and entering game:GetService("DataStoreService"):GetDataStore("PointsData"), and then saving the place. That might fix it.

Edit: I just re-read your code and it seems you don't even use it. Removing the line local datastore = game:GetService("DataStoreService"):GetDataStore("PointsData") should fix it.

Ad

Answer this question