spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:17 PM |
I tried making one based off the roblox leaderboard but it didn't work because of how all the functions are laid out. Does anyone know how?
|
|
|
| Report Abuse |
|
|
| |
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:19 PM |
Like when you kill someone, your the owner of the kill and you get exp, kills, etc.
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:20 PM |
use a remote event to fire that you killed them or use some sort of tagging device to tag the killer to the victim and have the victim add the kill |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:21 PM |
already tried something similar to that but didn't use a remote event.
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:22 PM |
To go deeper into what Wunder said If you're tagging, make a new objectvalue named "creator" into the dead dude. This is the universal ROBLOX tagging system. |
|
|
| Report Abuse |
|
|
treebee63
|
  |
| Joined: 16 Aug 2010 |
| Total Posts: 376 |
|
|
| 07 Nov 2016 08:25 PM |
| You'll have to set up a tagging function. It would place an objectValue referencing to the attacker's player inside of the person being attacked. You can then bind an event to get the attacker once the player dies and award them with points (or something of your choice). A lot of the roblox default tools (LinkedSword, Slingshot, TimeBomb, etc.) use this system along with their leaderboards. Their function is usually named "tagHumanoid." |
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:25 PM |
"This is the universal ROBLOX tagging system."
Well since roblox no longer tracks those on site, its kinda pointless to use that method if you are making your own tools and don't plan to use someone elses. Remote events would be much cleaner. |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:26 PM |
this is how im trying to right now. local tag = humanoid:FindFirstChild('creator')
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:27 PM |
That is true, but it's useful in case you do use other people's stuff. I personally usually use free models for tools and guns and stuff a lot, so I guess that works for me. If you plan on using your own stuff, I guess you should use events. |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:27 PM |
Let me try this first and see where i can go from there.
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:29 PM |
Here is an example:
local damage = workspace.DealDamage --remote event damage:FireServer(targetPlayer,20)
--server:
workspace.DealDamage.OnServerEvent:connect(function(sender,target,damage) local prev = target.Character.Humanoid.Health target.Character.Humanoid:TakeDamage(damage) if target.Character.Humanoid.Health<=0 and prev>0 then target.leaderstats.Deaths.Value=target.leaderstats.Deaths.Value+1 sender.leaderstats.Kills.Value=sender.leaderstats.Kills.Value+1 end end)
--if you are using server sided scripts for both, use a bindable event instead! |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:32 PM |
Wow i guess this is one way but i just finished mine im about to see if it works.
game.Players.PlayerAdded:connect(function(Player) local PlayerStats = game.ServerStorage["Player Stats"]:WaitForChild(Player.Name) local Character = Player.Character or Player.CharacterAdded:wait() local Humanoid = Character:WaitForChild('Humanoid') local db = false Humanoid.Died:connect(function() if db == false then db = true PlayerStats.Deaths.Value = PlayerStats.Deaths.Value + 1 local Tag = Humanoid:FindFirstChild('creator') if Tag then local player = Tag.Value PlayerStats.XP.Value = PlayerStats.XP.Value + 100 PlayerStats.Kills.Value = PlayerStats.Kills.Value + 1 end end end); end);
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:33 PM |
Mine has the same security as yours but would probably be the easiest option
So yes if you are using a server script you can convert it to a bindable event instead |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:37 PM |
Hmm, the one i made doesn't actually work.
|
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:41 PM |
What does the (targetPlayer,20) do?
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 08:42 PM |
......FireServer(targetPlayer,20)
......target,damage) |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 08:51 PM |
Didn't work, im just going to find a way to fix this one:
game.Players.PlayerAdded:connect(function(Player) local PlayerStats = game.ServerStorage["Player Stats"]:WaitForChild(Player.Name) local Character = Player.Character or Player.CharacterAdded:wait() local Humanoid = Character:WaitForChild('Humanoid') Humanoid.Died:connect(function() PlayerStats.Deaths.Value = PlayerStats.Deaths.Value + 1 end); local Tag = Humanoid:FindFirstChild('creator') if Tag then local player = Tag.Value PlayerStats.XP.Value = PlayerStats.XP.Value + 100 PlayerStats.Kills.Value = PlayerStats.Kills.Value + 1 end; end);
|
|
|
| Report Abuse |
|
|
|
| 07 Nov 2016 09:03 PM |
It does work, you need a remote event and you need to fire it from a local script with a server script handling the remote
you can try by giving everyone leaderstats for kills and deaths
then use damage on Player1 |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 07 Nov 2016 09:54 PM |
Im really bad with remote functions/events, i dont make fe games so i never saw a need for them.
|
|
|
| Report Abuse |
|
|