Well, I don’t think it really matters where it goes, as long you can get it working with finding values it should work.
i really apologize but im new the the language Lua
You can’t say just Deaths.Value
, you have to say something like player.leaderstats.Deaths.Value
.
Don’t worry for that mistake. Many people forget to do that. Even myself!
As well as that, you have to when defining the humanoid you have to say player.Character:FindFirstChild("Humanoid")
and say the Character in upper case and not lower case.
Those were the main things which I saw wrong within the script.
I think then you should not start with doing this on the earliest go as feedback from me. I think you should start with something more basic and not starting with using super hard things such as Datastores. Of course it’s up to you but many people would not do this if they are new. Sorry if I sounded harsh there.
Hope this helps!
So, I just revised your script and fixed it, it works now.
local DSS = game:GetService("DataStoreService")
local MyDS = DSS:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder", plr); leaderstats.Name = "leaderstats";
local kills = Instance.new("IntValue", leaderstats); kills.Name = "Kills";
local Deaths = Instance.new("IntValue", leaderstats); Deaths.Name = "Deaths";
local KillStreak = Instance.new("IntValue", leaderstats); KillStreak.Name = "killStreak";
plr.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
humanoid.Died:Connect(function(died)
Deaths.Value += 1
KillStreak.Value = 0
local tag = humanoid:FindFirstChild("creator")
local killer = tag.Value
if tag and killer then
killer.leaderstats:FindFirstChild("Kills").Value += 1
killer:FindFirstChild("killstreak").Value += 1
end
end)
end)
end)
thank you so much for the help and advice also do you have any good ways on the better way to learn Lua
do i put it under ServerScriptService
Yes, under ServerScriptService for it to work properly.
ok so yes it did work but when i kill a zombie it did not do anything
Alright in the zombie you’re most likely to have to make a script to detect when the zombie dies. Then you might be able to get the points to the player.
i have no idea how to do that thats been one of my problems
are you able to help me with that since you help me with the leaderBoard
Yes, of course give me a few minutes working on it.
thank you so much your amazing
Mainly as I said up there. Do not think that you’ll be able to create the next Jailbreak in 1 week or something I believe.
I would also say try to stay dedicated to it and try to google when there is syntax you don’t understand. As well as that. I used to play around with free models and try to learn the scripts within them. The reason why is because then I can learn from that and apply that knowledge somewhere else. Also because many people these days have hard to plan out scripts because they don’t fully understand the syntax.
Hope this helps!
thank you so much for the advise it really helps
Did you figure it out? Just making sure you didn’t forget about me lol sorry if I’m annoying you
Still working on it, but I’m going to have to focus on class soon enough, so i’ll double task, might take longer.
its ok if it takes longer I’ve been waiting for 2 weeks thanks you so much for still helping me
hey, How are you with that script ?
have all the time you need im just seeing how far you got on it