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 » Roblox » All Things ROBLOX
Home Search
 

Re: Scripting helpers wont help

Previous Thread :: Next Thread 
Buildize is not online. Buildize
Joined: 28 Jul 2011
Total Posts: 4605
20 Oct 2015 07:37 PM
I am trying to make a script that makes players auto equip a weapon when they click an ImageButton
I'm doing it wrong for sure, I don't know how to script at all.
repeat wait() until script.Parent.Parent.Parent and script.Parent
a = script.Parent

a.MouseButton1Down:connect(function()
game.Players.LocalPlayer.EquiptTool(Lighting.AssautRifle)
end)


I took parts from the Wiki and from another script that someone else made for me that teleports players once they click the ImageButton
Report Abuse
BevelBrick is not online. BevelBrick
Joined: 07 Jun 2015
Total Posts: 5377
20 Oct 2015 07:37 PM
Make it yourself
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 07:38 PM
so, you either messed up by
1. not using a local script, since you used LocalPlayer, which means you have to use a local script

2. you spelt "EquipTool" wrong
Report Abuse
Buildize is not online. Buildize
Joined: 28 Jul 2011
Total Posts: 4605
20 Oct 2015 07:39 PM
I'm using a Local Script
Report Abuse
Buildize is not online. Buildize
Joined: 28 Jul 2011
Total Posts: 4605
20 Oct 2015 07:42 PM
I fixed the spelling error still wont work.
Report Abuse
PsychopathicScripter is not online. PsychopathicScripter
Joined: 01 Mar 2014
Total Posts: 64
20 Oct 2015 07:45 PM
so if im not mistaken

u are looking for a script that equips a tool when you press a button?



http://www.roblox.com/Cartman-as-a-cop-item?id=154382436 Ay, I am a cop and you will respect my authoritah.
Report Abuse
PsychopathicScripter is not online. PsychopathicScripter
Joined: 01 Mar 2014
Total Posts: 64
20 Oct 2015 07:46 PM
try pressing f9 to see if there are any problems

the red and blue ones u should look at



http://www.roblox.com/Cartman-as-a-cop-item?id=154382436 Ay, I am a cop and you will respect my authoritah.
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 07:52 PM
Fix the spelling mistake after EquipTool where it says "Lightning" it should say "Lighting", and also make sure you spelt "AssaultRiffle" right in both the lighting and inside the script
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 07:52 PM
Also, I would do game.Lighting.AssaultRiffle instead of Lighting.AssaultRiffle
Report Abuse
Buildize is not online. Buildize
Joined: 28 Jul 2011
Total Posts: 4605
20 Oct 2015 07:52 PM
What I am trying to do is once the player(s) press an ImageButton (this is dealing with GUIs) it makes them auto equip a weapon.
Here's what I have


repeat wait() until script.Parent.Parent.Parent and script.Parent
a = script.Parent

a.MouseButton1Down:connect(function()
game.Players.LocalPlayer.EquipTool(Lighting.AssaultRifle)
end)

Line 5: Lighting has a blue underline
Report Abuse
Buildize is not online. Buildize
Joined: 28 Jul 2011
Total Posts: 4605
20 Oct 2015 07:55 PM
I changed it to game.Lighting.AssaultRifle
Everything is spelt correct
Heres the script:


repeat wait() until script.Parent.Parent.Parent and script.Parent
a = script.Parent

a.MouseButton1Down:connect(function()
game.Players.LocalPlayer.EquipTool(game.Lighting.AssaultRifle)
end)




Still not working
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 07:55 PM
As I said, do game.Lighting not Lighting. Also, are you sure "EquipTool" is a function of Player, I looked in the wiki and I didnt see anything.
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 08:03 PM
So. I have no clue if EquipTool is or isnt a function, but I made a version that works.

wait()
a = script.Parent
local definegun = "AssaultRiffle"

a.MouseButton1Down:connect(function()
local backpack = game.Players.LocalPlayer.Backpack

if backpack:FindFirstChild(definegun) == nil and game.Players.LocalPlayer.Character:FindFirstChild("AssaultRiffle") == nil then
local gun = game.Lighting:FindFirstChild(definegun):clone()
gun.Parent = game.Players.LocalPlayer.Character
else
backpack:FindFirstChild(definegun):remove()
game.Players.LocalPlayer.Character:FindFirstChild(definegun)

local gun = game.Lighting:FindFirstChild(definegun):clone()
gun.Parent = game.Players.LocalPlayer.Character
end
end)
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 08:05 PM
Update, forgot a specific part of the script.

wait()
a = script.Parent
local definegun = "AssaultRiffle"

a.MouseButton1Down:connect(function()
local backpack = game.Players.LocalPlayer.Backpack

if backpack:FindFirstChild(definegun) == nil and game.Players.LocalPlayer.Character:FindFirstChild("AssaultRiffle") == nil then
local gun = game.Lighting:FindFirstChild(definegun):clone()
gun.Parent = game.Players.LocalPlayer.Character
else
backpack:FindFirstChild(definegun):remove()
game.Players.LocalPlayer.Character:FindFirstChild(definegun):remove()

local gun = game.Lighting:FindFirstChild(definegun):clone()
gun.Parent = game.Players.LocalPlayer.Character
end
end)
Report Abuse
Buildize is not online. Buildize
Joined: 28 Jul 2011
Total Posts: 4605
20 Oct 2015 08:25 PM
Thanks I'll have to add it after school.
Report Abuse
56bit is not online. 56bit
Joined: 02 Dec 2014
Total Posts: 410
20 Oct 2015 08:25 PM
hi
Report Abuse
Djahi is not online. Djahi
Joined: 18 Oct 2015
Total Posts: 84
20 Oct 2015 08:29 PM
just saying, but this one will probably be more helpful
the other one has an odd bug that appears every once in a while when yu press the button. i literally have no clue why it happens but, like i said, this one might be better since you probably dont want them to spam the weapon button

wait()
a = script.Parent
local definegun = "AssaultRiffle"

a.MouseButton1Down:connect(function()
local backpack = game.Players.LocalPlayer.Backpack

if backpack:FindFirstChild(definegun) == nil and game.Players.LocalPlayer.Character:FindFirstChild("AssaultRiffle") == nil then
local gun = game.Lighting:FindFirstChild(definegun):clone()
gun.Parent = game.Players.LocalPlayer.Character
else
return
end
end)
Report Abuse
TwistedMemories is not online. TwistedMemories
Joined: 08 Jul 2013
Total Posts: 565
20 Oct 2015 08:30 PM
I think I have heard of that EquipTool thing. I think you have to use a : But you can try em both.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Roblox » All Things ROBLOX
   
 
   
  • 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