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: Script Fix?

Previous Thread :: Next Thread 
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
26 Aug 2011 10:54 AM
I'm a newb scripter so I would appreciate some help with fixing this :3

It's a tycoon-like buy button, but it broke when shot, so I added:

if hit ~= nil then
if hit.Parent ~= nil then

Now however, it doesn't work at all...

Here's the full thing:

model = script.Parent.Parent.Parent.MyModelName --Change the last part to your upgrade-models name
Upgradecost = 150 --Change cost to upgrade
-------------------------------------------------------------------------------------------------------------------------

upgradeStuff = model:clone()--The thing that will be spawned when button is pushed
--basically the "After"-part of the upgrade.. :P

model:remove() --remove the ingame model. We saved a clone for later.

local ting = 0 --debouncer

function onTouched(hit)
if hit ~= nil then
if hit.Parent ~= nil then
if ting == 0 then --check for debounce
ting = 1 --activate debounce

check = hit.Parent:FindFirstChild("Humanoid") --try to find the human that touched the button

if check ~= nil then --if toucher is a human then to following

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder

if stats ~= nil then --If moneyholder exists then
local cash = stats:findFirstChild("Money") --Get money
if cash.Value > (Upgradecost-1) then --If there is enough money then

cash.Value = cash.Value - Upgradecost --remove cash
upgradeStuff.Parent = script.Parent.Parent.Parent --put the upgrade into the game
script.Parent.Parent:remove() -- remove the upgrade button (in case of one-upgrade only)

end
end
end

ting = 0 --remove debounce
end
end

script.Parent.Touched:connect(onTouched) --start checking for touchers
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
26 Aug 2011 11:16 AM
NO ONE is going to "fix" this for you.

If you don't make your own scripts and encounter your own problems, you will never learn and you will just repeatedly come back here for help.
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
26 Aug 2011 11:19 AM
I do make my own scripts...
This is just one that I haven't made myself, as it is to complex for me...
I am trying to edit it, and encountered a problem...

O.T.:
You're from Ireland right?
Me too, from Kildare, you? :3
Report Abuse
61352151511 is not online. 61352151511
Joined: 30 Nov 2009
Total Posts: 8094
26 Aug 2011 11:20 AM
When you add an if statement remember to add the end.

~ Mitch ~
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
26 Aug 2011 11:22 AM
Uhh sorry, I don't give out the location of my dwelling.

-Meath
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
26 Aug 2011 11:24 AM
@Mitch, oh my God, I feel like such an idiot now... Thank you for poitning that out :3

@Mario, lol, an maith leat caca? :P
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
26 Aug 2011 11:33 AM
Níl, is maith liom cáca milis. Agus a ghlacadh as ar an "a" as le caca as Gaeilge focal agus féach cad a fhaigheann tú. : 3
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
26 Aug 2011 11:35 AM
...
*Backs away*
Ehhh...
...
I'm gunna take a wild guess and say your are older than me...
I'm in second year...Going into third on Monday :(
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
26 Aug 2011 11:38 AM
I'm in second year...Going into third on Tuesday XD
Report Abuse
bladeclone is not online. bladeclone
Joined: 06 Jul 2009
Total Posts: 2179
26 Aug 2011 11:41 AM
Me too I guess, school starts on Tuesday but we go iin on Monday to get our st00f ready...
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
26 Aug 2011 12:10 PM
I'm turning Year 8 on Tuesday..
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