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: How could I change this to work with a Gui?

Previous Thread :: Next Thread 
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 04:44 PM
local passid = 93044881
local tools = {"Illumina"}
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)



I Tried twice but failed trying to make it work when I click a button



Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 04:59 PM
:/\:
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 05:16 PM
:/?
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 05:21 PM
:\?
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 05:31 PM
?:/
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
14 May 2014 05:33 PM
Put ur tool in Lighting and name it exactly the same ( INclUdINg capITAls ) as in the table.
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 08:01 PM
Yes I did that already

I want to make it activate when I click a gui button

I am not exactly sure where to put

function sword()



end
script.Parent.MouseButton1Down(sword)


In the script
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 08:26 PM
:/\
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 08:46 PM
:\:/
Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
14 May 2014 08:48 PM
script.Parent.MouseButton1Down:connect(function(sword)
local passid = 93044881
local tools = {"Illumina"}
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)
end)
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 08:53 PM
does not work sidekick

I put the script in startergui > screengui > textbutton

and when I click the button it does nothing in online mode and solo
Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
14 May 2014 08:55 PM
is it in a local script?
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 08:58 PM
Oh no should it be?
Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
14 May 2014 08:59 PM
Give it a try and tell me what happens.
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 09:01 PM
tried It did not work either :/


Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
14 May 2014 09:03 PM
oops, try this. if it doesnt work i'm not sure what the problem is


local passid = 93044881
local tools = {"Illumina"}
local GamePassService = Game:GetService('GamePassService')

script.Parent.MouseButton1Down:connect(function(sword)

repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)


Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 09:14 PM
nope did not work for both types

it works fine in workplace without the script.Parent.MouseButton1Down:connect

I just wanted them to click the gui and they would get the sword
Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
14 May 2014 09:16 PM
-- THIS SHOULD BE IN A LOCAL SCRIPTTTTTT
local tools = {"Illumina"}
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function(hopefullythisworks)

repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 May 2014 09:18 PM
That should work if and only if script.Parent is a TextButton, and the tool exists.
Remove the FindFirstChild or actually check if the child is nil.

game.Lighting[tools[i]]:Clone().Parent = player.Backpack
game.Lighting[tools[i]]:Clone().Parent = player.StarterGear
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 May 2014 09:23 PM
Nice 20000th post and thanks
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
15 May 2014 03:07 PM
ah no luck with it
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
15 May 2014 03:30 PM
:l
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 May 2014 03:32 PM
script.Parent.MouseButton1Click:connect()
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
15 May 2014 03:34 PM
script in workspace


local passid = 93044881
local tools = {"Illumina"}
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
Instance.new("Model",player).Name = "Has"
end
end)

localscript in textbutton

player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
if game.Players.LocalPlayers:FindFirstChild("Has") then
local passid = 93044881
local tools = {"Illumina"}
repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear

for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end

end
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
15 May 2014 03:35 PM
oop..

if player:FindFirstChild("Has") then

cuz I accidentily said "LocalPlayers" XD
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