Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Points Service :/ Please Help?

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)

1 comment

0

What exactly is your question?

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.