LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:03 PM |
admin = "LordGando"
function chatted (admin, msg) if msg == "mvp/" then search.player with highest KO and msg == "The MVP is"...player..."! Congrats!" (5)
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
-- I made this script, but I don't know how to do line 5
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:05 PM |
Anyone
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:06 PM |
use loops to go through the teams, and for each team use more loops to go through the players and their ko stats, have variables with biggest ko and the player, something along the lines of this
local bigKO = 0 local bigPlyr = nil for n,v in pairs(game.Players:GetChildren()) local KO = PATHTOSTAT if KO > bigKO then bigKO = KO bigPlyr = v end end
print("Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic") |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:08 PM |
Is it like this
admin = "LordGando"
function chatted (admin, msg) if msg == "mvp/" then local bigKO = 0 local bigPlyr = nil for n,v in pairs(game.Players:GetChildren()) local KO = PATHTOSTAT if KO > bigKO then bigKO = KO bigPlyr = v then print("Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic") end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
Is that the right way
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:10 PM |
Is it
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:11 PM |
Nope :3
first i made teh typo change loop to this for n,v in pairs(game.Players:GetChildren()) do
now you have to change where it says PATHTOSTAT to get to the ko stat, i think it will be in the player or maybe the teams or something like that I forget. Maybe something like this?
local KO = v.Kills.Value
i have no idea never needed to use leaderboard stats |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:18 PM |
Wont work, anything I might have to find it to fix it.
Would this work local KO = v.KOs.Value
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:20 PM |
| How are the KO's determined, on leaderboard? |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:24 PM |
To be honest, I don't know. I'm using owens leaderboard. I still didn't make my own.
-Script-
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 if deaths.Value>10 then player.TeamColor=BrickColor.new("White") end
-- do short dance to try and find the killer
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
handleKillCount(humanoid, player) 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("KOs") if killer ~= player then kills.Value = kills.Value + 1 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
kills.Parent = stats deaths.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)
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:26 PM |
Yo
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:27 PM |
local KO = v.leaderstats.KOs.Value
This should work. |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:36 PM |
It wont work, here is what I got.
function chatted (player, msg) if msg == "mvp/" then local bigKO = 0 local bigPlyr = nil for n,v in pairs(game.Players:GetChildren()) do local KO = v.leaderstats.KOs.Value if KO > bigKO then bigKO = KO bigPlyr = v print("Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic") end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:37 PM |
| Teh error output plox? And do you see your leaderboard stats on the leaderboard? |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:38 PM |
Yup, KOs and WOs.
This is what I do, change my KO to 1 then say mvp/ but the message wont print of anything.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:39 PM |
| Are you testing in offline mode? |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:40 PM |
Nope, online mode. So, I save then I click Play.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:41 PM |
| I don't believe you can see output online, so how do you know it is not printing? |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:42 PM |
Wait, isn't print like msg.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:43 PM |
lol no, replace
print("Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic")
with
local msg = Instance.new("Message",workspace) msg.Txt = "Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic" wait(1) msg:Destroy() |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:44 PM |
I also thought print was like msg, THATS WHY MOST OF MY 3 LINE SCRIPTS DONT WORK.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:46 PM |
| change my msg variable name to something else cause that's one of your arguments if u wanna use it later in script |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:48 PM |
This is the script, and it still wont work q.q
function chatted (player, msg) if msg == "mvp/" then local bigKO = 0 local bigPlyr = nil for n,v in pairs(game.Players:GetChildren()) do local KO = v.leaderstats.KOs.Value if KO > bigKO then bigKO = KO bigPlyr = v local msg = Instance.new("Message",workspace) msg.Txt = "Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic" wait(5) msg:Destroy() end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:49 PM |
function chatted (player, msg) if msg == "mvp/" then local output = Instance.new("Message",workspace) output.Txt = "You chatted mvp/ so now the script will begin" wait(2) msg:Destroy() local bigKO = 0 local bigPlyr = nil for n,v in pairs(game.Players:GetChildren()) do local KO = v.leaderstats.KOs.Value if KO > bigKO then bigKO = KO bigPlyr = v local output = Instance.new("Message",workspace) output.Txt = "Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic" wait(2) msg:Destroy() end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
Use this and tell me what you see |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2013 04:50 PM |
JUST KIDDING USE THIS
if msg == "mvp/" then local output = Instance.new("Message",workspace) output.Text = "You chatted mvp/ so now the script will begin" wait(2) msg:Destroy() local bigKO = 0 local bigPlyr = nil for n,v in pairs(game.Players:GetChildren()) do local KO = v.leaderstats.KOs.Value if KO > bigKO then bigKO = KO bigPlyr = v local output = Instance.new("Message",workspace) output.Text = "Person with most epic kills is "..bigPlyr.Name..". Yeah he is so epic" wait(2) msg:Destroy() end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end) |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 07 Jul 2013 04:53 PM |
Still wont work
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|