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: Script Line Won't Work

Previous Thread :: Next Thread 
Skenderbeu98 is not online. Skenderbeu98
Joined: 11 Aug 2013
Total Posts: 467
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
Skenderbeu98 is not online. Skenderbeu98
Joined: 11 Aug 2013
Total Posts: 467
26 Dec 2013 11:45 AM
Anyone?
Report Abuse
Skenderbeu98 is not online. Skenderbeu98
Joined: 11 Aug 2013
Total Posts: 467
26 Dec 2013 12:53 PM
ok
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
26 Dec 2013 12:58 PM
if cash.Value > (Upgradecost-1) then
remove the -1
Report Abuse
Skenderbeu98 is not online. Skenderbeu98
Joined: 11 Aug 2013
Total Posts: 467
26 Dec 2013 01:03 PM
That's not it, it works before I put that line in that I labeled above.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
26 Dec 2013 01:06 PM
oh hit has to be a player not a model
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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 is not online. 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
Skenderbeu98 is not online. Skenderbeu98
Joined: 11 Aug 2013
Total Posts: 467
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
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