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 » Scripters
Home Search
 

Re: Kill Tag troubles

Previous Thread :: Next Thread 
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
15 Sep 2015 11:58 PM
I have this script that is supposed to work like the LinkedLeaderboard, but instead of changing values in the leaderboard, it changes values in a player's gui.

print("KillCorder Loaded!")
DefaultCam=game.Workspace.CurrentCamera


function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("PlayerGui")
if stats ~= nil then
local mons = stats:findFirstChild("MoneyGui")
local deaths = mons.cashText.Points
deaths.Value = deaths.Value - 0
game.Workspace.CurrentCamera=DefaultCam
local killer = getKillerOfHumanoidIfStillInGame(humanoid)

handleKillCount(humanoid, player)
end
end

function onPlayerRespawn(property, player)
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
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("PlayerGui")
if stats ~= nil then
local kills = stats:findFirstChild("MoneyGui")
if killer ~= player then
local pts = kills.cashText.Points.Value
pts = pts + 1

else
local pts = kills.cashText.Points.Value
pts = pts - 1

end
end
end
end

I get nothing out of the output box, or in the console in game when I kill my alt acc.

I think it has to do with location, but I'm not sure.

Please help me.
Report Abuse
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
16 Sep 2015 12:00 AM
I do realize now, after I posted, that the

" local deaths = mons.cashText.Points
deaths.Value = deaths.Value - 0 "

part is redundant...
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
16 Sep 2015 12:14 AM
leaderstats should be a child of the player, not the playergui
Report Abuse
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
16 Sep 2015 12:24 AM
That is what I'm having trouble with, I don't want to change a value in the leaderstats, I want to change a value in the Player's Gui. This way, a script can update a Gui with the new value found in the Player's Gui.


--I can put my waits wherever I want.
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
16 Sep 2015 12:25 AM
Are you using the game's leaderboard OR a custom made GUI
Report Abuse
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
16 Sep 2015 12:28 AM
A custom Gui.


--I can put my waits wherever I want.
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
16 Sep 2015 12:31 AM
Too lazy to read over, so if you want an easier check, if someone died, just check if their health is == 0. There's only one person who can gain points from killing unless there's a sheriff in your game, so you don't need to check who killed who, if u understand what I'm saying
Report Abuse
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
16 Sep 2015 12:37 AM
*Facepalm can be heard around the world*

Everyone in my game is going to be killing everyone. Well, sort of. There will be teams, but that's not the point. I don't know what I'm doing wrong. I'll try putting 'print()' functions in to see where it's going wrong, but I'll have to do that later.

If you are going to comment, please read the whole post, or don't comment at all.


--I can put my waits wherever I want.
Report Abuse
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
16 Sep 2015 12:38 AM
I still want help, by the way.



--I can put my waits wherever I want.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
16 Sep 2015 04:21 AM
This is why kill/death handling shouldn't be handled by outdated methods (like 'tagging'), they're just inefficient, and some people mess up terribly.

Go learn RemoteEvents
Report Abuse
iFallenAtlantis is not online. iFallenAtlantis
Joined: 29 Feb 2012
Total Posts: 240
16 Sep 2015 08:51 PM
@warpsyking

Thanks for the idea. It looks much easier.



--I can put my waits wherever I want.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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