Game script problem help?
So I have things on this game pretty close to done but there are 2 things missing. If you can take the time to help me with these problems I'd appreciate it(I posted these questions individually yesterday but no one answered)
First since everything is linked to the leaderboard, here is my leaderboard script:
01 | game.Players.PlayerAdded:connect( function (player) |
02 | local stats = Instance.new( "IntValue" ) |
03 | stats.Name = "leaderstats" |
06 | local experience = Instance.new( "IntValue" ) |
07 | experience.Name = "Experience" |
09 | experience.Parent = stats |
11 | local cash = Instance.new( "IntValue" ) |
16 | local kills = Instance.new( "IntValue" ) |
22 | experience.Value = experience.Value + 15 |
Now my problem is the kills. I got a script from someone here but it seems like it doesn't quite work..The weapons in my game are the linked sword, a sniper, chaingun(gamepass weapon) and the R-orb.
01 | function handleKillCount(humanoid, player) |
02 | local killer = getKillerOfHumanoidIfStillInGame(humanoid) |
04 | local stats = killer:findFirstChild( "leaderstats" ) |
06 | local kills = leaderstats:findFirstchild( "Kills" ) |
07 | local cash = leaderstats:findFirstChild( "Cash" ) |
08 | if killer ~ = player then |
09 | kills.Value = kills.Value + 1 |
10 | cash.Value = cash.Value + 150 |
13 | kills.Value = kills.Value - 0 |
15 | Send_DB_Event_Kill(killer, player) |
20 | game.Players.ChildAdded:connect(onPlayerEntered) |
If you can help fix the script or give me some help i would greatly appreciate it. Now the 2nd problem would be a in game gui shop.
01 | plr = game.Players.LocalPlayer |
02 | medkit = game.Lighting.Medkit:clone() |
04 | script.Parent.MouseButton 1 Click:connect( function () |
05 | local v = plr.leaderstats.Cash |
07 | medkit.Parent = plr.Backpack |
I am not so sure why that does not work...In Lighting I have the Medkit...Can someone help?
Any help is greatly appreciated. Thanks.