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

DataStores Problem it wont work at all.. Why wont this Work?

i dont have a clue what is wrong here at all!!!

ive been trying for ages ;(

data = game:GetService("DataStoreService")
save = data:GetDataStore("Tools")


game.Players.PlayerAdded:connect(function(player)
	k = player.Backpack:WaitForChild("BDtest")
	k.Value = save:GetAsync(player.UserId) or 0
	save:SetAsync(player.UserId, k.Value)
	game.Players:WaitForChild(player)
	k.Changed:connect(function()
		save:SetAsync(player.UserId, k.Value)
	end)
	if k.Value == 1 then
		game.ReplicatedStorage.vamp["Blood Drain"]:Clone().Parent = player:WaitForChild("Backpack")
		player.Backpack["Stone Mask"]:Destroy()
		save:SetAsync(player.UserId, k.Value)
	end
end)



game.Players.PlayerRemoving:connect(function(player)
	local k = player.Backpack:WaitForChild("BDtest")	
	save:SetAsync(player.UserId, k.Value)
	if k.Value == 1 then
		save:SetAsync(player.UserId, k.Value)
	end
end)

1 comment

0

tried print debugging?

1 answer

Hey,

Not an idea whether this will work or not but I mean, I can try to help.

Have you tried for example on line 7:

    k.Value = save:GetAsync(tostring(player.UserId)) or 0

Probably won't work but I mean, give it a shot if you want.

Sam

1 comment

0

stupid feggot

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