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
 

Re: HELP!

Previous Thread :: Next Thread 
2fast4u247 is not online. 2fast4u247
Joined: 19 Nov 2010
Total Posts: 2062
08 Sep 2011 07:10 AM
Ok, Im making a game where you get 50 points everytime you kill someone, but the guns don't give you 50 points when you kill! I have a script that says that, but it doesnt work!
Help!
Thanks,
~2fast
•»Penguins Can't Fly, But i Can.«•
Report Abuse
thisissporez is not online. thisissporez
Joined: 04 Sep 2011
Total Posts: 1273
08 Sep 2011 07:12 AM
Yeah...
no.
Report Abuse
2fast4u247 is not online. 2fast4u247
Joined: 19 Nov 2010
Total Posts: 2062
08 Sep 2011 07:14 AM
Somebody? The script is:
function onPlayerEntered(newPlayer)


local stats = Instance.new("IntValue")
stats.Name = "leaderstats"


local points = Instance.new("IntValue")
points.Name = "Points" --Change "Points" to change the currency name.
points.Value = 200 --Change the 0 to how much you want people to start with

points.Parent = stats
stats.Parent = newPlayer

local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Value = 0

local deaths = Instance.new("IntValue")
deaths.Name = "Deaths"
deaths.Value = 0

kills.Parent = stats
deaths.Parent = stats

---------------------------------------------------------------------------------------------------------------
-- Do not edit past here or the script might break!!!! LOL i edited past this actually made this.--
---------------------------------------------------------------------------------------------------------------
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

function Send_DB_Event_Died(victim, killer)
-- killer may be nil
local killername = "unknown"
if killer ~= nil then killername = killer.Name end
print(victim.Name, " was killed by ", killername)

if shared["deaths"] ~= nil then
shared["deaths"](victim, killer)
print("Death event sent.")
end
end

function Send_DB_Event_Kill(killer, victim)
print(killer.Name, " killed ", victim.Name)
if shared["kills"] ~= nil then
shared["kills"](killer, victim)
print("Kill event sent.")
end
end



function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local deaths = stats:findFirstChild("Deaths")
deaths.Value = deaths.Value + 1
local points = stats:findFirstChild("Points")
points.Value = points.Value - 25

-- do short dance to try and find the killer

local killer = getKillerOfHumanoidIfStillInGame(humanoid)


Send_DB_Event_Died(player, killer)
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("Kills")
if killer ~= player then
kills.Value = kills.Value + 1
local points = stats:findFirstChild("Points")
points.Value = points.Value + 50

else
kills.Value = kills.Value - 0

end
Send_DB_Event_Kill(killer, player)
end
end
end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
RoyalPeacemaker is not online. RoyalPeacemaker
Joined: 26 Apr 2011
Total Posts: 2715
08 Sep 2011 07:56 AM
Where'd you put the script?
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
08 Sep 2011 08:31 AM
[ Content Deleted ]
Report Abuse
2fast4u247 is not online. 2fast4u247
Joined: 19 Nov 2010
Total Posts: 2062
08 Sep 2011 08:39 AM
I know the script isnt mine.
And the script is in workspace.

•»Penguins Can't Fly, But i Can.«•
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
08 Sep 2011 08:39 AM
[ Content Deleted ]
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
08 Sep 2011 10:00 AM
@my, how mean to talk to a person like that, you should post a fix THEN say that :P
Report Abuse
Fl0xData is not online. Fl0xData
Joined: 01 Aug 2011
Total Posts: 18
08 Sep 2011 10:37 AM
No.
Just because there's nothing that actually would give a tool to the player.
Since he's asking for that bit of code, it's a request, and nothing is broken.
We only fix scripts, not edit them the way you want it to work.
Report Abuse
Fredfishy is online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
08 Sep 2011 10:53 AM
@Fl0x, actually, we edit them the way you want them to work. That includes fixing. As long as we can see people have had a good go at it, we help.
Report Abuse
Fl0xData is not online. Fl0xData
Joined: 01 Aug 2011
Total Posts: 18
08 Sep 2011 10:55 AM
If you think fixing equals editing, you have some serious mind problems.
Fixing = Making it work the way it _should_ work
Editing = Adding/Removing stuff that may not be necessary to the actual script.
Report Abuse
Fredfishy is online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
08 Sep 2011 10:57 AM
@Fl0x, So you're saying fixing contains no editing of any sort? We just sort of stare at the script and it works?
Also, you're saying that they don't WANT the script to work the way it "should", which would be how they wanted it to. So you're basically contradicting yourself.
Report Abuse
Fl0xData is not online. Fl0xData
Joined: 01 Aug 2011
Total Posts: 18
08 Sep 2011 10:58 AM
Okay then;
print("3')

Fix it so it makes a car.
Report Abuse
Fredfishy is online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
08 Sep 2011 11:00 AM
That isn't you having a "good go" at making a script. That's you just saying "print". You haven't included anything in there even REMOTELY related to creating a car. Even if you wrote "print "car"", that STILL isn't having a "good go" at creating it.
Report Abuse
Fl0xData is not online. Fl0xData
Joined: 01 Aug 2011
Total Posts: 18
08 Sep 2011 11:02 AM
Exactly, the car is not related to the actual script.
Same for the script that 2fast4u247 (copied &) posted.
The tool giving part is totally NOT RELATED TO THE SCRIPT.

print("3')

NOT MAKE IT A CAR.
Report Abuse
Fredfishy is online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
08 Sep 2011 11:29 AM
Point to the part where he requested a gun be given.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
08 Sep 2011 11:37 AM
FLAME WAR ENEDED!!

========================================================
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
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