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 |
|
|
| |
|
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
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 4605 |
|
| |
|
Buildize
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 4605 |
|
|
| 20 Oct 2015 07:42 PM |
| I fixed the spelling error still wont work. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 02 Dec 2014 |
| Total Posts: 410 |
|
| |
|
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 |
|
|
|
| 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 |
|
|