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
 

[ Content Deleted ]

Previous Thread :: Next Thread 
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:21 PM
[ Content Deleted ]
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Apr 2014 07:22 PM
Because you are changing the tool in starterpack.
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:24 PM
[ Content Deleted ]
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Apr 2014 07:25 PM
You are changing the tool in starterpack... Not in backpack.
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:27 PM
[ Content Deleted ]
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Apr 2014 07:28 PM
Yeah, but if the tool is equipped, it's parent is the character.
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:30 PM
[ Content Deleted ]
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Apr 2014 07:32 PM
if plr.Character:FindFirstChild("Tool") then
f=plr.Character['Tool']
elseif plr.Backpack:findFirstChild("Tool") then
f=plr.Backpack['Tool']
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:33 PM
[ Content Deleted ]
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Apr 2014 07:34 PM
Whatever flashlight is, I thought it was f sorry.
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:36 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:37 PM
[ Content Deleted ]
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Apr 2014 07:39 PM
function die()
--here




tell me if it works
Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
29 Apr 2014 07:40 PM
First off

stat = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Players.LocalPlayer.leaderstats.Gold
^
Ew


plr = game.Players.LocalPlayer
stat = plr.leaderstats.Gold
stat2 = plr.leaderstats.Rubies

function die()
if stat.Value>=10 then

f = plr.Backpack.Flashlight.LightPart.Light
f.Range = f.Range + 7
f.Brightness = f.Brightness + 12
stat.Value = stat.Value - 10

elseif stat2.Value>=5 then

f.Brightness = f.Brightness + 12
f.Range = f.Range + 7
stat2.Value = stat2.Value - 10

else

script.Parent.Text = ("You don't have enough currency!")
wait(5)
script.Parent.Text = ("Upgrade Flashlight")

end
end

script.Parent.MouseButton1Down:connect(die)

Second off:
And there is a lot to be done there, like disconnecting when giving error message, editng flashlight when equipped (in players hand / character model), appropriat function names? (die? really?)
Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
29 Apr 2014 07:47 PM
wait. still not done, my bad.



plr = game.Players.LocalPlayer
stat = plr.leaderstats.Gold
stat2 = plr.leaderstats.Rubies

function UpgradeFlashlight()
local flashlight = plr.Backpack:FindFirstChild("Flashlight") or plr.Character:FindFirstChild("Flashlight") --Check if in backpack or equipped

if (flashlight ~= nil) then --If flashlight exists
local light = flashlight.LightPart.Light --Declare before if statements, not in one if you're using it in multiple if statements

if (stat.Value >= 10) then

light.Range = light.Range + 7
light.Brightness = light.Brightness + 12
stat.Value = stat.Value - 10

elseif (stat2.Value >= 5) then

light.Brightness = light.Brightness + 12
light.Range = light.Range + 7
stat2.Value = stat2.Value - 5 --I think you meant 5, not 10

else

script.Parent.Text = ("You don't have enough currency!")
wait(5)
script.Parent.Text = ("Upgrade Flashlight")

end
end
end

script.Parent.MouseButton1Down:connect(UpgradeFlashlight)
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 07:47 PM
[ Content Deleted ]
Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
29 Apr 2014 07:49 PM
Sorry for spam > final revision

plr = game.Players.LocalPlayer
stat = plr.leaderstats.Gold
stat2 = plr.leaderstats.Rubies

function UpgradeFlashlight()
local flashlight = plr.Backpack:FindFirstChild("Flashlight") or plr.Character:FindFirstChild("Flashlight") --Check if in backpack or equipped

if (flashlight ~= nil) then --If flashlight exists
local light = flashlight.LightPart.Light --Declare before if statements, not in one if you're using it in multiple if statements

if (stat.Value >= 10) then

light.Range = light.Range + 7
light.Brightness = light.Brightness + 12
stat.Value = stat.Value - 10

elseif (stat2.Value >= 5) then

light.Brightness = light.Brightness + 12
light.Range = light.Range + 7
stat2.Value = stat2.Value - 5 --I think you meant 5, not 10

else
connection:disconnect();
script.Parent.Text = ("You don't have enough currency!")
wait(5)
script.Parent.Text = ("Upgrade Flashlight")
connection = script.Parent.MouseButton1Down:connect(UpgradeFlashlight)
end
end
end

connection = script.Parent.MouseButton1Down:connect(UpgradeFlashlight)
Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
29 Apr 2014 07:50 PM
well sorry for trying to teach you a thing and two and you're welcome for fixing it.
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 08:04 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 08:06 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 08:06 PM
[ Content Deleted ]
Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
29 Apr 2014 08:07 PM
script.Parent.Text = "You don't have enough currency!"
wait(5)
script.Parent.Text = "Upgrade Flashlight"



didnt see that one
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 08:43 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 09:01 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
29 Apr 2014 09:07 PM
[ Content Deleted ]
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