Sorry, I meant GetPlayerFromCharacter instead of GetPlayerByCharacter. You can change it so that it works.
It worked! All i needed is to copy the data store script with data store lines removed don’t know if i should mark my reply as a solution or @cakehunterman’s latest reply i mean he did say to cut the datastore code so i will mark it as a solution but yeah finally found a solution after 82 replies thanks to those 15 users that helped solve my problem!
1 Like
CharacterAdded
sometimes doesn’t fire, try this instead
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder",plr)
leaderstats.Name = "leaderstats"
local Deaths = Instance.new("IntValue",leaderstats)
Deaths.Name = "Deaths"
local character = plr.Character or plr.Character:Wait() --if no character, wait for it to exist
character:WaitForChild("Humanoid").Died:Connect(function()
Deaths.Value += 1
game.ReplicatedStorage.ServerOofs.Value += 1
end)
It does fire the solution was that i only had to copy the script and then remove the leaderstats lines as you can see from this checkmark thing
On my end, it sometimes didn’t fire at all.
Im glad it worked! Have a great day!