|
| 12 Oct 2009 04:40 PM |
it looks PERFECT to me but yet noting im trying to make a button to buy a weapon with KOs but it dose not work i put T1 in lishting(FYI) heres the script
------------------------------------------------------------------------------------------------------- ------------------------------------- Change this Values ---------------------------------------- -- Buy Pad (Work with Cash,Money,Gold and KO's)
local CashPrice = 99999999999 -- If you want cash, add your value, if not, put a big number. local MoneyPrice = 999999999999 -- big number if you want to buy with another thing. local GoldPrice = 99999999999 -- another time... local KOPrice = 0 -- be free to edit. local ToolName = "T1" -- A tool name in Lighting
-- You can make possible to sell with more of one thing. -- Put your tool in Lighting to make this Work.
------------------------------- Change variables above this ---------------------------------- -------------------------------------------------------------------------------------------------------
local Tool = game.Lighting:findFirstChild(ToolName) local deb = 0 function Touch(hit) if (deb == 0) then deb = 1 local user = game.Players:GetPlayerFromCharacter(hit.Parent) local hu = hit.Parent:findFirstChild("Humanoid") if user ~= nil and hu ~= nil then buy = false local stats = user:findFirstChild("leaderstats") local s1 = stats:findFirstChild("Cash") local s2 = stats:findFirstChild("Money") local s3 = stats:findFirstChild("KO's") local s4 = stats:findFirstChild("Gold") if Tool == nil then print("game.Lighting." ..ToolName.. " not found!!!") else if s1 ~= nil then if s1.Value-CashPrice >= 0 then print("You buy with Cash!") buy = true Tool:clone().Parent = user.Backpack script.Parent.BrickColor = BrickColor.new("Bright red") else print("No enough Cash. Searching a new stat.") end end if s2 ~= nil and buy == false then if s2.Value-MoneyPrice >= 0 then print("You buy with Money!") buy = true Tool:clone().Parent = user.Backpack script.Parent.BrickColor = BrickColor.new("Bright red") else print("No enough Money. Searching a new stat.") end end if s3 ~= nil and buy == false then if s2.Value-KOPrice >= 0 then print("You buy with KO's!") buy = true Tool:clone().Parent = user.Backpack script.Parent.BrickColor = BrickColor.new("Bright red") else print("No enough KO's. Searching a new stat.") end end if s4 ~= nil and buy == false then if s2.Value-KOPrice >= 0 then print("You buy with Gold!") buy = true Tool:clone().Parent = user.Backpack script.Parent.BrickColor = BrickColor.new("Bright red") else print("No enough Gold. No stats found.") end end if buy == false then print("You have no Cash,Money,KO's or Gold to buy.") end end end end end
script.Parent.Touched:connect(Touch) |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2009 04:43 PM |
| should i chang 0 to 3 but i want it free |
|
|
| Report Abuse |
|
|
Eyin
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 567 |
|
|
| 12 Oct 2009 04:45 PM |
| Is your script disabled? If not , open the output in edit mode, then press the "play" button. |
|
|
| Report Abuse |
|
|
Vengroe
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 3057 |
|
|
| 12 Oct 2009 04:47 PM |
I always prefer:
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
user = game.Players:findFirstChild(human.Parent.Name)
local gold = user.leaderstats:findFirstChild("KO's")
If gold ~= nil then
gold.Value = gold.Value - price -- change to price local tool = game.Lighting.Toolname:clone() -- put the name of the tool here, and the tool in lighting tool.Parent = user.Backpack
m = Instance.new("Hint")
m.Text = "Here's your tool1"
m.Parent = player
wait(2)
m.Parent = nil
else
m = Instance.new("Hint")
m.Text = "*ERROR*"
m.Parent = player
wait(3)
m.Parent = nil
end
wait(2)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
|
| 14 Oct 2009 07:06 AM |
| dissabled i thot it works just like that |
|
|
| Report Abuse |
|
|