generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Leaderboard Help

Previous Thread :: Next Thread 
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
19 Jul 2013 08:13 AM
Okay, I'm trying to make a script that will give a player money when they kill a member of another team. Everything works, except allies do not make money to kill players, which I actually need. I think I might be missing something in the table where allies are at the top, but I saw nothing on the output window.

--%Tkv1yYRhpicRbxVHDZQnaf3y84n0Lv5elv/c7ydDbqHs7AxRkxCo2DrpFW9U5ytbVEMduvh721v3l4wKqDKv25ZdC+YUen9msRFjPwuvgiWRjlsgcT6QO0hD4ar9TY0yhWmyULuL5nQudmfaA3Kr0sBeesM45v8y3+hHMt45B34=%%1018966%print("LinkedLeaderboard script version 5.00 loaded")

stands = {}
CTF_mode = false


function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
-- local deaths = stats:findFirstChild("Wipeouts")
-- deaths.Value = deaths.Value + 1

-- find the killer

local killer = getKillerOfHumanoidIfStillInGame(humanoid)

if (player.TeamColor == game.Teams["Players"].TeamColor) or (player.TeamColor == game.Teams["Allies"].TeamColor) then
if (killer.TeamColor == game.Teams["Raiders"].TeamColor) then
handleKillCount(humanoid, player)
end
elseif (player.TeamColor == game.Teams["Raiders"].TeamColor) then
if (killer.TeamColor == game.Teams["Players"].TeamColor) or (killer.TeamColor == game.Teams["Allies"].TeamColor) then
handleKillCount(humanoid, player)
end
elseif (player.TeamColor == game.Teams["Allies"].TeamColor) then
if (killer.TeamColor == game.Teams["Raiders"].TeamColor) or (killer.TeamColor == game.Teams["Players"].TeamColor) then
handleKillCount(humanoid, player)
end
end
end
end

function onPlayerRespawn(property, player)
-- need to connect to new humanoid

if property == "Character" and player.Character ~= nil then
local humanoid = player.Character.Humanoid
local p = player
local h = humanoid
humanoid.Died:connect(function() onHumanoidDied(h, p) end )
end
end

function getKillerOfHumanoidIfStillInGame(humanoid)
-- returns the player object that killed this humanoid
-- returns nil if the killer is no longer in the game

-- check for kill tag on humanoid - may be more than one - todo: deal with this
local tag = humanoid:findFirstChild("creator")

-- find player with name on tag
if tag ~= nil then

local killer = tag.Value
if killer.Parent ~= nil then -- killer still in game
return killer
end
end

return nil
end

function handleKillCount(humanoid, player)
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
if killer ~= nil then
local stats = killer:findFirstChild("leaderstats")
if stats ~= nil then
local kills = stats:findFirstChild("Money")
if killer ~= player then
kills.Value = kills.Value + 100

else
-- kills.Value = kills.Value - 1

end
end
end
end


-----------------------------------------------



function findAllFlagStands(root)
local c = root:children()
for i=1,#c do
if (c[i].className == "Model" or c[i].className == "Part") then
findAllFlagStands(c[i])
end
if (c[i].className == "FlagStand") then
table.insert(stands, c[i])
end
end
end

function hookUpListeners()
for i=1,#stands do
stands[i].FlagCaptured:connect(onCaptureScored)
end
end

function onPlayerEntered(newPlayer)

if CTF_mode == true then

local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local captures = Instance.new("IntValue")
captures.Name = "Captures"
captures.Value = 0


captures.Parent = stats

-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end

stats.Parent = newPlayer

else

local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local kills = Instance.new("IntValue")
kills.Name = "KOs"
kills.Value = 0

local deaths = Instance.new("IntValue")
deaths.Name = "Wipeouts"
deaths.Value = 0

local credits = Instance.new("IntValue")
credits.Name = "Money"
credits.Value = 0

--kills.Parent = stats
--deaths.Parent = stats
credits.Parent = stats

-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end

local humanoid = newPlayer.Character.Humanoid

humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )

-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )


stats.Parent = newPlayer

end

end


function onCaptureScored(player)

local ls = player:findFirstChild("leaderstats")
if ls == nil then return end
local caps = ls:findFirstChild("Captures")
if caps == nil then return end
caps.Value = caps.Value + 1

end


findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)

Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
19 Jul 2013 09:18 AM
Bump?
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
19 Jul 2013 01:22 PM
Bump.
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
19 Jul 2013 07:33 PM
Bump...
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
19 Jul 2013 11:03 PM
Bump.
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 12:10 AM
BUMP.
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 01:30 AM
Bump!
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 04:17 AM
Bump...
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
20 Jul 2013 04:19 AM
YOu can't just take a free model and expect it to work..

CLIKC HER 4 A BIG SUPRISE. AER U SUPRISE?
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 04:36 AM
It's not a "free model", I made this with a friend about a year ago.

Right now, I'm trying to edit it.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
20 Jul 2013 04:41 AM
Lies, I've seen it before.

CLIKC HER 4 A BIG SUPRISE. AER U SUPRISE?
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
20 Jul 2013 04:43 AM
Pal. This is just a old CTF Leaderboard script created by Roblox. So when you are trying to get help by honest, would you.. Else we won't help you at all.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
20 Jul 2013 04:46 AM
Exactly, "i made it myself" hahah

CLIKC HER 4 A BIG SUPRISE. AER U SUPRISE?
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 12:32 PM
Where did I say "I made it myself?"

Exactly, no where.

Since you must know, Poomuffin and I both worked on this script.

As to whether or not it's completely made from scratch, I do not know.

He started it, I helped edit it. I have not touched this in a year.

I'm not on here to be questioned about whether or not the script is a free model.

I'm on here asking for help.

Thank you.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
20 Jul 2013 12:42 PM
Why don't you ask your friend, Stickmasterluke, the creator, and sole editor, of the script.

CLIKC HER 4 A BIG SUPRISE. AER U SUPRISE?
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 05:02 PM
Can't tell if illiterate... Or sarcastic...

As stated above, I do not know if it was made from scratch. I received most of it from Poomuffin. He told me which parts to edit, I did, and it no longer works.

I'm not on here looking for handouts. I did not find this in free models, and simply claim it as mine. You can't say I'm "dishonest" simply because someone gives me a script that I've never seen before, and claims it as theirs.

Report Abuse
Constructor189 is not online. Constructor189
Joined: 28 Apr 2013
Total Posts: 219
20 Jul 2013 05:10 PM
This forum sucks. They won't offer any help at all.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
20 Jul 2013 05:29 PM
I was being sarcastic, but fair enough! I would help you, but I'm too tired and on my phone.

Constructor, this sub-forum doesn't suck, it's just you can't expect us to look the through hundreds of lines of code for others straight away.
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
20 Jul 2013 10:46 PM
@Constructor

Nah, it doesn't suck, I've gotten plenty of help from this forum.

I just don't like certain people who make accusations about people who are simply looking for help.
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
21 Jul 2013 06:34 PM
Bump.
Report Abuse
Juanxojito is not online. Juanxojito
Joined: 25 May 2012
Total Posts: 436
21 Jul 2013 08:15 PM
B
U
M
P
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 08:20 PM
Nobody here can be bothered to edit this script, due to how long it is mixed with howvits made by Roblox (not even edited, due to the hash code at the top). Try learning to script and making it yourself.
Report Abuse
DrWaffler is not online. DrWaffler
Joined: 16 Sep 2011
Total Posts: 4248
21 Jul 2013 08:23 PM
Since he made the script.

AND I QUOTE, "I made this" directly form his reply.

He should know EXACTLY what this does.

%Tkv1yYRhpicRbxVHDZQnaf3y84n0Lv5elv/c7ydDbqHs7AxRkxCo2DrpFW9U5ytbVEMduvh721v3l4wKqDKv25ZdC+YUen9msRFjPwuvgiWRjlsgcT6QO0hD4ar9TY0yhWmyULuL5nQudmfaA3Kr0sBeesM45v8y3+hHMt45B34=%%1018966%print("LinkedLeaderboard script version 5.00 loaded")

If we were honestly all so stupid to NOT know when one of ROBLOX's "default" scripts are being posted, we wouldn't be here.

This is ROBLOX's Pre-Fabbed leaderboards.

I am reborn as an ocelot. You disapprove.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 08:23 PM
Ah, I see. A new value is added and the code is commented out.
Even so,myou should learn and make it yourself.
You will need

Players.PlayerAdded event
Instance.new function
Player.CharacterAdded event
Humanoid.Died event

And whatever event is called when a player captures a flag.
Report Abuse
dabestscripterevar is not online. dabestscripterevar
Joined: 16 Jul 2013
Total Posts: 78
21 Jul 2013 08:31 PM
ugh ugh u shud know u scripterz
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image