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

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

Asked by 5 years ago
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)
0
Line 20 ErtyPL 129 — 5y
0
Delete end at line 20 and add it on line 25 ErtyPL 129 — 5y
0
Local script or normal and also where do I put it? charlesec 36 — 5y
1
*Screaming from a distance* SAVE STUFF IN TABLES, LIKE 100% MORE CLEANER! BashGuy10 384 — 5y

1 answer

Log in to vote
1
Answered by
ErtyPL 129
5 years ago
Edited 5 years ago

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)
Ad

Answer this question