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

I am making a simulator my script for leaderstats does not work any help?

PointData = game:GetService("DataStoreService"):GetDataStore("PointData")
RebirtData = game:GetService("DataStoreService"):GetDataStore("RebirthData")

game.Players.PlayerAdded:Connect(function(plr)
	local LB Instance.new ("IntValue")
	LB.Name "leaderstats"
	LB.Parent = plr
	
	local p = Instance.new ("IntValue")
	p.Name = "Points"
	p.Parent = LB
	P.Value = PointData:GetAsync(plr.userId)or 0
	
end)
local r = Instance.new ("IntValue")
	r.Name = "Rebirths"
	r.Parent = LB
	r.Value = RebirthData:GetAsync(plr.userId)or 0
	
end)

game.Players.PlayerRemoved:Connect(function(plr)
PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value)
RebirtData:SetAsync(plr.userId, plr.leaderstats.Rebirths.Value)

4 comments

0

Line 20

0

Delete end at line 20 and add it on line 25

0

Local script or normal and also where do I put it?

1

Screaming from a distance SAVE STUFF IN TABLES, LIKE 100% MORE CLEANER!

1 answer

✓ Accepted answer

Hope I helped :] you made typos

PointData = game:GetService("DataStoreService"):GetDataStore("PointData")
RebirthData = game:GetService("DataStoreService"):GetDataStore("RebirthData")
plr = game.Players.LocalPlayer

game.Players.PlayerAdded:Connect(function(plr)
    local LB Instance.new ("IntValue")
    LB.Name "leaderstats"
    LB.Parent = plr

    local p = Instance.new ("IntValue")
    p.Name = "Points"
    p.Parent = LB
    p.Value = PointData:GetAsync(plr.userId)or 0
	--[[P or p ? lua is case sensitive]]
	local r = Instance.new ("IntValue")
    r.Name = "Rebirths"
    r.Parent = LB
    r.Value = RebirthData:GetAsync(plr.userId)or 0
	
	
end)


--[[what is PlayerRemoved ? maybe u want .PlayerRemoving:]]
game.Players.PlayerRemoved:Connect(function(plr)
PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value)
RebirthData:SetAsync(plr.userId, plr.leaderstats.Rebirths.Value)
end)

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