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
 

How would I make players lose 50 points if they die?

Previous Thread :: Next Thread 
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 08:47 PM
--Here is the script, how do I make players lose 50 points if they are killed?

GamePassId = 0

local people = game.Players:GetPlayers()
for i = 1,#people do
if people[i]:findFirstChild("Dead") then
if people[i].Dead.Value == false then
people[i].Dead.Value = true
people[i].leaderstats.XP.Value = people[i].leaderstats.XP.Value + 100
if (Game:GetService('GamePassService'):PlayerHasPass(people[i],GamePassId)) then
people[i].leaderstats.XP.Value = people[i].leaderstats.XP.Value + 100
end
people[i].leaderstats.Survivals.Value = people[i].leaderstats.Survivals.Value + 1
end
end
end
end
end
Main()
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Nov 2012 08:48 PM
Connect Humanoid Died.
Leaderstat Value - 50

DER
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 08:50 PM
Type it in the script so I can see it.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
22 Nov 2012 08:51 PM
Kid, you're not learning to script like this..
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 08:58 PM
You're still here? Leave me the freak alone!
Report Abuse
billybobjoeybob is not online. billybobjoeybob
Joined: 18 Dec 2008
Total Posts: 364
22 Nov 2012 09:01 PM
"You're still here"

Chop sit's around all day helping people drowning in confusion in this sea we call rbx.lua. So yes, he's still here, where else would he be, living his life?
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 09:03 PM
Can anyone actually help?
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 09:14 PM
Bump.
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
22 Nov 2012 09:20 PM
game.Players.Humanoid.Died
Report Abuse
Dodeca is not online. Dodeca
Joined: 11 Sep 2011
Total Posts: 13649
22 Nov 2012 09:21 PM
function losePoints()
Player.Leaderboard.Stats = Leaderboard.stats(-50)
end

This won't work at all..
Report Abuse
1cooldude361 is not online. 1cooldude361
Joined: 13 Mar 2010
Total Posts: 4403
22 Nov 2012 09:24 PM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
char.Humanoid.Died:connect(function()
player.leaderstats.Points = player.leaderstats.Points - 50
end)
end)
end)

Tactical Rainboom Inbound
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 09:27 PM
@Dodeca

Then why did you post it?
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 09:28 PM
@1cool

Can you post that in the whole script so I can see how it fits in with the rest of the script?
Report Abuse
1cooldude361 is not online. 1cooldude361
Joined: 13 Mar 2010
Total Posts: 4403
22 Nov 2012 09:38 PM
I'd rather just recreate your whole script.

GamepassID = 0--Change this to whatever the gamepassid is

game.Players.PlayerAdded:connect(function(player)
if game:GetService("GamePassService"):PlayerHasPass(player, GamepassID) then
player.leaderstats.XP = player.leaderstats.XP + 100
elseif player.Character.Humanoid.Health ~=0 then
wait(60)--change 60 to the time between rounds
if player.Character.Humanoid.Health ~= 0 then
player.leaderstats.Survivals = player.leaderstats.Survivals + 1
player.CharacterAdded:connect(function(char)
char.Humanoid.Died:connect(function()
player.leaderstats.Points = player.leaderstats.Points - 50
end
end)
end)
end)

-I dunno if this would work or not, I didn't really think while making it.

Tactical Rainboom Inbound
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 09:40 PM
I don't want the rounds part. I've already gotten that taken care of.
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
22 Nov 2012 09:43 PM
Bump. :/
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
23 Nov 2012 03:03 PM
Shut up and learn to script!
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
23 Nov 2012 03:12 PM
LoseAmount = 50
local Players = Game:GetService("Players")
Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Died:connect(function()
Player.leaderstats.Survivals.Value = Player.leaderstats.Survivals.Value - LoseAmount
end)
end
end)
end)
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
23 Nov 2012 03:13 PM
Just put this in a script in Workspace AND it will only work on online mode
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
23 Nov 2012 03:28 PM
Brayden99's got it.
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
23 Nov 2012 03:40 PM
Do I add that to the script I already posted?
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
23 Nov 2012 03:42 PM
If you want
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
23 Nov 2012 03:53 PM
Do you not have to? Could I just add a new script and put that in the new script?
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
23 Nov 2012 03:56 PM
Yep.
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
23 Nov 2012 03:57 PM
Okay. I hope.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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