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 » Scripters
Home Search
 

Re: Mousebutton1click to move tools from lighting

Previous Thread :: Next Thread 
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 02:53 PM
Why exactly wont this work? Seems dumb, I have experience with other coding languages but still getting used to lua
script.Parent.MouseButton1Click:connect(function()
game.Lighting.gun.Parent = game.StarterPack
end
Report Abuse
JDLENL is online. JDLENL
Joined: 23 Dec 2009
Total Posts: 1109
17 Aug 2017 02:55 PM
why...would you want a script to move tools from ################ ############ ##### to another one?
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
17 Aug 2017 02:57 PM
Don't store stuff in the Lighting service;
connect is deprecated in favor for Connect;
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 02:59 PM
If i store it in server-storage instead of lighting and

local store = game:GetService("ServerStorage")
local g = x.gun
Script.Parent.MouseButton1Click:connect(function()
x.Parent = game.StarterPack
End


should that work^%
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 03:00 PM
Basically what I want is to make a gun appear in starter pack once onclicked
Report Abuse
WrathVoid is not online. WrathVoid
Joined: 20 Apr 2011
Total Posts: 939
17 Aug 2017 03:03 PM
Are you looking for it to be put in someone's inventory? Or just in starterpack?
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 03:03 PM
Well yes inventory so we can use it in game.
Report Abuse
Master_NG is online. Master_NG
Joined: 24 Jun 2016
Total Posts: 100
17 Aug 2017 03:04 PM
You need to find the player who clicked. The way you're doing it makes it so that it is in the starter pack which is items that are given to the players on join or reset so if something is added to it, it will only be given to the player after they reset. Also just as a reminder if you put it in starter-pack it will give it to all the players.


Report Abuse
Master_NG is online. Master_NG
Joined: 24 Jun 2016
Total Posts: 100
17 Aug 2017 03:05 PM
Unless you want all the players to have this certain item.



Report Abuse
JDLENL is online. JDLENL
Joined: 23 Dec 2009
Total Posts: 1109
17 Aug 2017 03:05 PM
probably turn FE off if it's not already

put a localscript in the gui button and put this inside
put your "gun" in game.ReplicatedStorage

script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.gun:Clone().Parent = game.Players.LocalPlayer.Backpack
end)

Report Abuse
Master_NG is online. Master_NG
Joined: 24 Jun 2016
Total Posts: 100
17 Aug 2017 03:08 PM
^^That would work but do they want only one person to have the item?


Report Abuse
JDLENL is online. JDLENL
Joined: 23 Dec 2009
Total Posts: 1109
17 Aug 2017 03:10 PM
if it's in a gui in startergui then everyone'll have that button, and everyone'll be able to spawn themselves a gun.

just in case you want ONE person to give EVERYONE a gun,

script.Parent.MouseButton1Click:Connect(function()
for _,i in pairs(game.Players:GetPlayers()) do
game.ReplicatedStorage.gun:Clone().Parent = i.Backpack
end
end)
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 03:14 PM
Yes, that's what I want because its a training facility
Report Abuse
JDLENL is online. JDLENL
Joined: 23 Dec 2009
Total Posts: 1109
17 Aug 2017 03:16 PM
then put that in a button in only one person's gui
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 03:21 PM
Thank you so much!
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 07:50 PM
How do you make it so when you respawn you still have the gun?
Report Abuse
Ezuras is online. Ezuras
Joined: 07 Nov 2012
Total Posts: 8768
17 Aug 2017 07:55 PM
script.Parent.MouseButton1Click:Connect(function()
for _,i in pairs(game.Players:GetPlayers()) do
game.ReplicatedStorage.gun:Clone().Parent = i.Backpack
local gunClone =game.ReplicatedStorage.Gun:Clone().Parent = i.StarterPack
end
end)

This script will allow you to use it upon respawn as well.

(credits to JDLENL for the original script <3 )
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 08:33 PM
Thank you, but it Unfortunately doesn't work for some reason. Nothing in the output either
When I reset, the gun is not in my starterpack
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 09:06 PM
B
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 09:53 PM
B
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
17 Aug 2017 09:57 PM
script.Parent.MouseButton1Click:connect(function()
game.Lighting.gun:Clone().Parent = game.Players.LocalPlayer.Backpack
end
Report Abuse
tonygamezftw is online. tonygamezftw
Joined: 27 Sep 2014
Total Posts: 612
17 Aug 2017 11:31 PM
read above^^
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
18 Aug 2017 12:17 AM
Uh so if you click the button you forever get it?


mk.


Put this at the end of payste bin / bin paste / paiste bin / you know

/WkDbaJqA


or heres raw code: (may be filtered)

local plr = game.Players.LocalPlayer;


local plrVal = plr:FindFirstChild("MyVal") or Instance.new("BoolValue", plr).Name = "MyVal"

local alreadyGiven = false;

if plrVal and plrVal == true then
game.Lighting.gun.Parent = plr.Backpack;
alreadyGiven = true;
end

script.Parent.MouseButton1Click:connect(function()
if plr.Backpack:FindFirstChild("gun") and alreadyGiven == true then
else
game.Lighting.gun:Clone().Parent = plr.Backpack;
alreadyGiven = true;
end
end)
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
18 Aug 2017 12:18 AM
local plr = game.Players.LocalPlayer;


local plrVal = plr:FindFirstChild("MyVal") or Instance.new("BoolValue", plr).Name = "MyVal"

local alreadyGiven = false;

if plrVal and plrVal.Value == true then
game.Lighting.gun:Clone().Parent = plr.Backpack;
alreadyGiven = true;
end

script.Parent.MouseButton1Click:connect(function()
if plr.Backpack:FindFirstChild("gun") and alreadyGiven == true then
else
game.Lighting.gun:Clone().Parent = plr.Backpack;
alreadyGiven = true;
end



Quick edit, that should work
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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