Theman1635 Sun Oct 04, 2009 10:18 pm
Random Script Time :3
--Just Put Your Model in the Buy Button Part
--==========================
model = "Wall2" ---change this to your model name.
cost = 0 --- change this to how much you want to cost.
modelname = "Wall" --What The Name with be on Buy Brick .
stat = "Money"--The Stat Name.
----Teams----
onlyworkforteams = false --If You want it only to work if you are a certain team.
teamname = "Blue" --Name of the Team
----Group-----
onlyworkforgroup = false --If you want it only to work if you are a certain member of this group.
wgroup = {"Person1","Player","Person3"}--The Group
----Person----
onlyworkforperson = false --If you want it only to work if you are a certain person.
personname = "Owner"
----Tshirt----
onlyworkfortshirt = false
tshirt = "Url"
--Make them All False If you want it to work for everyone
----Removing Models----
removemodel = true--Set to true if you want to be able to buy to remove the brick
----Unlocking----Only works if Removemodel is set to false
unlock = "Buy Button2"--When you press this button it makes this appear like you press this button it makes something else appear
unlockwork = false--Set to true if you want to unlock
--==========================
group = script.Parent.Parent.Parent
unlockp = group.Parent:GetChildren()
if unlockwork == true then
if group.Parent[unlock] ~= nil then
unlockm = group.Parent[unlock]
unlockc = unlockm:clone()
unlockm:remove()
end
end
models = group:findFirstChild(model)
model2 = models:clone()
if removemodel == false then
models:remove()
end
pt = script.Parent.Parent
local ting = 0
function add(hit,money,stat,model)
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild(stat)
if cash.Value > cost2 then
cash.Value = cash.Value - cost
model.Parent = group
script.Parent.Parent:remove()
end
end
end
function remove(hit,money,stat,model)
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild(stat)
if cash.Value > cost2 then
cash.Value = cash.Value - cost
model.Parent = nil
script.Parent.Parent:remove()
end
end
end
function checkgroup(name)
for i = 1,#wgroup do
if (string.upper(name) == string.upper(wgroup[i])) then return true end
end
return false
end
function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
if removemodel == true then
if onlyworkforteams == true then
if game.Players:playerFromCharacter(hit.Parent).TeamColor==game.Teams:findFirstChild(teamname).TeamColor then
remove(hit,cost,stat,models)
end
elseif onlyworkforgroup == true then
if checkgroup(hit.Parent.Name) then
remove(hit,cost,stat,models)
end
elseif onlyworkforperson == true then
if hit.Parent.Name == personname then
remove(hit,cost,stat,models)
end
elseif onlyworkfortshirt == true then
if hit.Parent.Torso.roblox.Texture == tshirt then
remove(hit,cost,stat,models)
end
else remove(hit,cost,stat,models)
end
else
if onlyworkforteams == true then
if game.Players:playerFromCharacter(hit.Parent).TeamColor==game.Teams:findFirstChild(teamname).TeamColor then
add(hit,cost,stat,model2)
if unlockwork == true then
unlockc.Parent = group.Parent
end
end
elseif onlyworkforgroup == true then
if checkgroup(hit.Parent.Name) then
add(hit,cost,stat,model2)
if unlockwork == true then
unlockc.Parent = group.Parent
end
end
elseif onlyworkforperson == true then
if hit.Parent.Name == personname then
add(hit,cost,stat,model2)
if unlockwork == true then
unlockc.Parent = group.Parent
end
end
elseif onlyworkfortshirt == true then
if hit.Parent.Torso.roblox.Texture == tshirt then
add(hit,cost,stat,model2)
if unlockwork == true then
unlockc.Parent = group.Parent
end
end
else add(hit,cost,stat,model2)
if unlockwork == true then
unlockc.Parent = group.Parent
end
end
if unlockwork == true then
unlockc.Parent = group.Parent
end
end
end
ting = 0
end
end
function onstart()
if removemodels == true then
if cost >= 1 then
cost2 = cost - 1
pt.Name = "Remove"..modelname.." - "..cost.."!"
else
pt.Name = "Remove "..modelname.." - Free!"
cost2 = 0
end
else
if cost >= 1 then
cost2 = cost - 1
pt.Name = "Buy "..modelname.." - "..cost.."!"
else
pt.Name = "Buy "..modelname.." - Free!"
cost2 = 0
end
end
end
onstart()
script.Parent.Touched:connect(onTouched)
Thu Apr 08, 2010 3:18 pm by Wako98
» X-101 Enemies
Thu Dec 31, 2009 1:48 pm by TrickyMaster11
» Hello! I'm new.
Thu Dec 31, 2009 1:39 pm by TrickyMaster11
» Groups: WHAT THEY ARE
Sun Dec 13, 2009 1:06 pm by Xtreme101
» Hi I am New.
Thu Nov 05, 2009 9:20 pm by Robo6420
» Notice: Please Use your ROBLOX account.
Thu Nov 05, 2009 9:19 pm by Robo6420
» Noob resistant Hover brick script
Thu Oct 08, 2009 6:29 pm by Robo6420
» Invitation Poll
Thu Oct 08, 2009 4:47 pm by Robo6420
» My First Video
Thu Oct 08, 2009 4:42 pm by Robo6420