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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 72 |
|
| |
|
Volcarox
|
  |
| Joined: 29 Jun 2011 |
| Total Posts: 16 |
|
| |
|
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 |
|
|