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: Button Scripting - Please Help

Previous Thread :: Next Thread 
Volcarox is not online. Volcarox
Joined: 29 Jun 2011
Total Posts: 16
08 Jul 2011 04:08 PM
Okay Guys I need help on button scripting. This is the script


model = script.Parent.Parent.Parent.brick1 --This is Where you place your name model here.. Change it from Model1 to what ever your model name is..
Upgradecost = 10 --This is what you want it to cost. Model1 costs 100 cash.
MoreCash = 10 --This is how much more money youll make when you by it
-------------------------------------------------------------------------------------------------------------------------
upgradeStuff = model:clone()
upgrad = script.Parent.Parent.Parent.Upgrad

wait(0)

model:remove()
owner = script.Parent.Parent.Parent.OwnerName
local ting = 0
trans = {}

function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")

if check ~= nil then
if hit.Parent.Name == owner.Value then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")

if stats ~= nil then
local cash = stats:findFirstChild("Cash")
if cash.Value > (Upgradecost-1) then

cash.Value = cash.Value - Upgradecost
upgrad.Value = upgrad.Value + MoreCash
upgradeStuff.Parent = script.Parent.Parent.Parent
UPparts = upgradeStuff:GetChildren()
for i = 1, #UPparts do
if UPparts[i]:IsA("BasePart") or UPparts[i]:IsA("Seat") then
table.insert(trans,UPparts[i].Transparency)
UPparts[i].Transparency = 1
end
end
script.Parent.Parent.Name = "Building..."
for i = 1, #UPparts do
if UPparts[i]:IsA("BasePart") or UPparts[i]:IsA("Seat") then
repeat
wait()
UPparts[i].Transparency = UPparts[i].Transparency -0.05
until UPparts[i].Transparency <= trans[i]
UPparts[i].Transparency = trans[i]
end
end
script.Parent.Parent:remove()
else
oldname = script.Parent.Parent.Name
script.Parent.Parent.Name = "You need $"..Upgradecost -cash.Value.." more to buy this"
wait(4)
script.Parent.Parent.Name = oldname
end
end
end
end

ting = 0
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
MassaIII is not online. MassaIII
Joined: 16 Mar 2008
Total Posts: 72
08 Jul 2011 04:09 PM
Can we know what's the problem and what the output says?
Report Abuse
Volcarox is not online. Volcarox
Joined: 29 Jun 2011
Total Posts: 16
08 Jul 2011 04:10 PM
When i walk onto the button it wont work
Report Abuse
MassaIII is not online. MassaIII
Joined: 16 Mar 2008
Total Posts: 72
09 Jul 2011 03:06 AM
Output?
Report Abuse
Volcarox is not online. Volcarox
Joined: 29 Jun 2011
Total Posts: 16
09 Jul 2011 06:16 AM
Where do i find that?
Report Abuse
MassaIII is not online. MassaIII
Joined: 16 Mar 2008
Total Posts: 72
09 Jul 2011 08:42 AM
Go to View (on top of your screen) click Toolbars and click on Output to make it visible. (I thought it's there but I'm not sure)
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