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
 

Whats wrong with this script?!

Previous Thread :: Next Thread 
tester140 is not online. tester140
Joined: 05 Aug 2008
Total Posts: 40
19 Apr 2009 04:24 PM
local part = script.Parent
local button = part.Parent
local machine = button.Parent
local land = machine.Parent
local debounce = false
cost = 80

function onTouched(hit)
if (debounce == false) then
debounce = true
local humanoid = hit.Parent:findFirstChild("Humanoid")
if (humanoid ~= nil) then
local player = game.Players:findFirstChild(hit.Parent.Name)
if (land.OwnerName.Value == player.Name) then
local stats = player:findFirstChild("leaderstats")
if (stats ~= nil) then
if (stats.Cash.Value >= cost) then
stats.Cash.Value = stats.Cash.Value - cost
local delay = machine.Delay
if (delay.Value > 7) then
delay.Value = delay.Value - 1
cost = cost * 2
button.Name = "Upgrade production! Cost: "..cost
elseif (delay.Value == 2) then
delay.Value = delay.Value - 1
button:remove()
end
else
local msg = Instance.new("Hint")
msg.Text = "You don't have enough Cash, "..player.Name.."!"
msg.Parent = player
wait(2)
msg:remove()
end
end
else
local msg = Instance.new("Hint")
msg.Text = "You aren't the owner of this Factory, "..player.Name.."!"
msg.Parent = player
wait(2)
msg:remove()
end
end
wait(0.5)
debounce = false
end
end

part.Touched:connect(onTouched)
Report Abuse
tester140 is not online. tester140
Joined: 05 Aug 2008
Total Posts: 40
19 Apr 2009 04:35 PM
bump
Report Abuse
tester140 is not online. tester140
Joined: 05 Aug 2008
Total Posts: 40
19 Apr 2009 08:19 PM
BUMP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Report Abuse
larryboylover92 is not online. larryboylover92
Joined: 20 Jul 2008
Total Posts: 4211
19 Apr 2009 08:21 PM
Looks like you got your ends right... lemme check connection...
Report Abuse
larryboylover92 is not online. larryboylover92
Joined: 20 Jul 2008
Total Posts: 4211
19 Apr 2009 08:22 PM
Yeah, beats me.
Report Abuse
Ozzypig is not online. Ozzypig
Joined: 27 Mar 2008
Total Posts: 4906
19 Apr 2009 08:23 PM
Why don't you look at the output and see if you can find what's wrong?
Report Abuse
tester140 is not online. tester140
Joined: 05 Aug 2008
Total Posts: 40
19 Apr 2009 08:34 PM
Nothing appears it just keeps on going without changing price se how it says * 2 on the cost value? It won't change =/
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