#I need help with a script !

1 messages · Page 1 of 1 (latest)

polar kettle
#

I made this script that adds ''Deaths'' value to the leaderboard, and also add +1 Death everytime a character dies, but it doesn't work, can anyone help?

analog sand
#

Because this ain't a event, this code just check when you start server, since you have local function, it does nothing, because you didn't trigger it from anywhere.

polar kettle
#

What do I do?

analog sand
polar kettle
#

I started learning scripting and modeling about 2 weeks ago, I'm really new to this 😭

analog sand
#

youre pretty close to it, all you need is an event/function trigger.

polar kettle
#

okayy

#

ill try to fix it

#

this code seemed to work, is the trigger for the event ''player.CharacterAdded:Connect(onCharacterAdded)'', im still kind of confused since it doesn't work without it

analog sand
#

Sorry, i didn't understand you fully, its it working or not?

By looking at code, it should be working fine.

polar kettle
#

Yes it is, sorry for not being clear but the last line of code, why do I need it, I know I need it for the code to work but I have no idea why i need it

analog sand
#

the line of code is calling an Event.

You could do this:

player.CharacterAdded:Connect(function(char)
  local humanoid = character:FindFirstChild("Humanoid")
  -- rest of code
end)

Its like you did in the Players.PlayerAdded.

It triggers, when Player joined the Server, it will setup the Folders. And do nothing.
Since you want to add Value of increase deaths. you add inside Players.PlayerAdded events, a death events, so the Server know, that they should trigger this code section, if someone died.