|
| 26 Dec 2013 11:25 AM |
Down below you have a standard Tycoon button script. This button in particular im trying to make a "VIP button", so I added a gamepass line, which for some reason breaks the script.
------------------------------------------------------------------------------------------------------------------------- model = script.Parent.Parent.Parent.VIPJet --This is the MODELNAME. you made a desk in the instructions SO name the part called MODELNAME to "Desk". Then change price to what you want. Upgradecost = 0 --This is what you want it to cost. the Example costs 100 cash. gamepass = 139903449 ------------------------------------------------------------------------------------------------------------------------- upgradeStuff = model:clone()
wait(1)
model:remove() owner = script.Parent.Parent.Parent.OwnerName local ting = 0
function onTouched(hit) if ting == 0 then ting = 1 if check ~= nil then if game:GetService("GamePassService"):PlayerHasPass(hit, gamepass) ~= nil then -- this line 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 upgradeStuff.Parent = script.Parent.Parent.Parent script.Parent.Parent:remove() end end end end end end ting = 0 end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 26 Dec 2013 12:58 PM |
if cash.Value > (Upgradecost-1) then remove the -1 |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2013 01:03 PM |
| That's not it, it works before I put that line in that I labeled above. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2013 01:06 PM |
| oh hit has to be a player not a model |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2013 01:08 PM |
upgradeStuff = model:clone()
wait(1)
model:remove() owner = script.Parent.Parent.Parent.OwnerName local ting = 0
function onTouched(hit) if ting == 0 then ting = 1 if check ~= nil then local user = game.Players:GetPlayerFromCharacter(hit.Parent) if game:GetService("GamePassService"):PlayerHasPass(user, gamepass) ~= nil then -- this line if hit.Parent.Name == owner.Value then 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 upgradeStuff.Parent = script.Parent.Parent.Parent script.Parent.Parent:remove() end end end end end end ting = 0 end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2013 01:10 PM |
Change if game:GetService("GamePassService"):PlayerHasPass(hit, gamepass) ~= nil then -- this line
TO
if game:GetService("GamePassService"):PlayerHasPass(game.Players:GetPlayerFromCharacter(hit.Parent), gamepass) ~= nil then -- this line
|
|
|
| Report Abuse |
|
|
|
| 31 Dec 2013 12:37 PM |
Why wont this work???
model = script.Parent.Parent.Parent.VIPJet --This is the MODELNAME. you made a desk in the instructions SO name the part called MODELNAME to "Desk". Then change price to what you want. Upgradecost = 0 --This is what you want it to cost. the Example costs 100 cash. gamepass = 139903449 -------------------------------------- upgradeStuff = model:clone()
wait(1)
model:remove() owner = script.Parent.Parent.Parent.OwnerName local ting = 0
function onTouched(hit) if ting == 0 then ting = 1 if check ~= nil then local user = game.Players:GetPlayerFromCharacter(hit.Parent) if game:GetService("GamePassService"):PlayerHasPass(user, gamepass) then -- this line if hit.Parent.Name == owner.Value then 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 upgradeStuff.Parent = script.Parent.Parent.Parent script.Parent.Parent:remove() end end end end end end ting = 0 end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|