When I touch the brick the Venomshank I put in Lighting does not Spawn in my backpack. Help?
01 | numofkills = game.Workspace.LeaderboardV 3. leaderstats.KOs.Value |
03 | script.Parent.Touched:connect( function () |
04 | if numofkills = = 0 then |
05 | for i, v in pairs (game.Players:GetChildren()) do |
06 | if v.Backpack ~ = nil then |
07 | clone 2 = game.Lighting.Venomshank:Clone() |
08 | clone 2. Parent = v.Backpack |
here is the leaderboard script as well
001 | print ( "Leaderboard script version 3.00 loaded" ) |
004 | function onPlayerEntered(newPlayer) |
007 | local stats = Instance.new( "IntValue" ) |
008 | stats.Name = "leaderstats" |
010 | local kills = Instance.new( "IntValue" ) |
014 | local deaths = Instance.new( "IntValue" ) |
015 | deaths.Name = "Wipeouts" |
019 | deaths.Parent = stats |
025 | if newPlayer.Character ~ = nil then break end |
029 | local humanoid = newPlayer.Character.Humanoid |
031 | humanoid.Died:connect( function () onHumanoidDied(humanoid, newPlayer) end ) |
034 | newPlayer.Changed:connect( function (property) onPlayerRespawn(property, newPlayer) end ) |
037 | stats.Parent = newPlayer |
041 | function Send_DB_Event_Died(victim, killer) |
043 | local killername = "no one" |
044 | if killer ~ = nil then killername = killer.Name end |
045 | print ( "DIED EVENT: " , victim.Name, " KILLED by " , killername) |
047 | if shared [ "deaths" ] ~ = nil then |
048 | shared [ "deaths" ] (victim, killer) |
049 | print ( "SENT DB DEATH EVENT" ) |
053 | function Send_DB_Event_Kill(killer, victim) |
054 | print ( "KILL EVENT. " , killer.Name, " BLOXXED " , victim.Name) |
055 | if shared [ "kills" ] ~ = nil then |
056 | shared [ "kills" ] (killer, victim) |
057 | print ( "SENT DB KILL EVENT" ) |
063 | function onHumanoidDied(humanoid, player) |
064 | local stats = player:findFirstChild( "leaderstats" ) |
066 | local deaths = stats:findFirstChild( "Wipeouts" ) |
067 | deaths.Value = deaths.Value + 1 |
071 | local killer = getKillerOfHumanoidIfStillInGame(humanoid) |
074 | Send_DB_Event_Died(player, killer) |
075 | handleKillCount(humanoid, player) |
079 | function onPlayerRespawn(property, player) |
082 | if property = = "Character" and player.Character ~ = nil then |
083 | local humanoid = player.Character.Humanoid |
086 | humanoid.Died:connect( function () onHumanoidDied(h, p) end ) |
090 | function getKillerOfHumanoidIfStillInGame(humanoid) |
095 | local tag = humanoid:findFirstChild( "creator" ) |
100 | local killer = tag.Value |
101 | if killer.Parent ~ = nil then |
109 | function handleKillCount(humanoid, player) |
110 | local killer = getKillerOfHumanoidIfStillInGame(humanoid) |
111 | if killer ~ = nil then |
112 | local stats = killer:findFirstChild( "leaderstats" ) |
114 | local kills = stats:findFirstChild( "KOs" ) |
115 | if killer ~ = player then |
116 | kills.Value = kills.Value + 1 |
119 | kills.Value = kills.Value - 1 |
122 | Send_DB_Event_Kill(killer, player) |
127 | game.Players.ChildAdded:connect(onPlayerEntered) |