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

Help! It says character added is not part of players, what do i do?

Asked by 2 years ago

local DStoreService = game:GetService("DataStoreService") local CashStore = DStoreService:GetDataStore("Cash")

game.Players.CharacterAdded(function(plr)

local MaxHealth = game.Workspace:WaitForChild("player.Name"):WaitForChild("Humanoid").MaxHealth
local CashValue = plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value
CashStore:SetAsync("plr_"..plr.UserId, CashValue, MaxHealth)

end)

game.Players.PlayerRemoving:Connect(function(plr) local MaxHealth = game.Workspace:WaitForChild("player.Name"):WaitForChild("Humanoid").MaxHealth local CashValue = plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value CashStore:GetAsync("plr_"..plr.UserId, CashValue, MaxHealth) end)

1 answer

Log in to vote
0
Answered by 2 years ago

Are you trolling me with that Lua Block?

anyways.

Heres the right way idk how to explain it so.

game.Players.PlayerAdded:Connect(function(player) -- We get the player first
    player.CharacterAdded:Connect(character) -- Now you can do that lol
        --stuff
    end)
end)

Simple mistake you should probably go to dev forum instead. But if this works give me my reward lol

Ad

Answer this question