- What are you attempting to achieve? im trying to have a leaderboard that if someone joins it gives you points
- What is the issue? theres no videos or solutions on devforum or youtube
- What solutions have you tried so far? i tried asking scripters and biulders but they dont know too
anyone plz??? plz anypone
anyone
What exactly are you trying to do here, if someone specifically joins you, you get a point, or if anyone joins they get a point? Please specify what you are trying to do more clearly.
im still active anyone? plzzzzzzzzzzzzzzzz
if someone joins they get the point and it stores in datastore too
As I said, if someone random joins not on purpose or if someone followed you into the game, please specify this.
if anyone joins like a player joined badge if someone joins like random people i dont know
I think there is no way to track the user who joined you. Unless You invite them?
like on player added they get a point
Make a PlayerAdded Function I think?
but im not good in scripting and idk how to make a data store with it
Ill try to make a script or a template
alright, I’ll just go with anyone joins.
local ds = game:GetService("DataStoreService")
local pointsds = ds:GetDataStore("Points")
game.Players.PlayerAdded:Connect(function(plr)
for i,v in pairs(game.Players:GetPlayers()) do
if v ~= plr then
v.leaderstats.Points.Value += 1
end
end
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local points = Instance.new("NumberValue")
points.Name = "Points"
points.Value = pointsds:GetAsync(plr.UserId) or 0
points.Parent = plr
end)
game.Players.PlayerRemoving:Connect(function(plr)
pointsds:SetAsync(plr.UserId, plr.leaderstats.Points.Value)
end)
game:BindToClose(function()
for i, plr in(game.Players:GetPlayers()) do
pointsds:SetAsync(plr.UserId, plr.leaderstats.Points.Value)
end
end)
but a person is already writing a script
leme try it real quick sheeeeeeeeeesh
There might be some errors, I didn’t test it out and wrote it on devforum.
ok lemme see reall quick sheeeeeesh
there is a error ill send a pick real quick
Workspace.Script:24: Expected ‘(’, ‘{’ or when parsing function call, got ‘:’