|
| 25 Nov 2014 04:47 PM |
I'm sure you guys would have a better idea on this than I do. This script has been wrote for me but I'm not sure whats up. It adds a tool to both a users backpack and starterpack and checks if they already have it. If they already have it then it will not be added.
function onTouched(part) p = game.Players:playerFromCharacter(part.Parent) if p == nil then return end Wep2 = game.Lighting.Pistol-(12):clone()
if p.StarterGear:findFirstChild(Wep2.Name) ~= nil then return end Wep2.Parent = p.StarterGear Wep2 = game.Lighting.Pistol-(12):clone() if p.Backpack:findFirstChild(Wep2.Name) ~= nil then return end Wep2.Parent = p.Backpack end
script.Parent.Touched:connect(onTouched)
My issue here is that this is the second time it is used in my game and is not working. I am assuming this is down to it registering the player as already having the item from the previous time it is used. I have changed it to "Wep2" assuming that would fix the problem but it hasn't. My only thought is that because the tool name has the updating ammo count in it then it might be messing with it.
In short, I tried and now I'm stuck. Anyone know whats up?
Thanks. |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Nov 2014 08:08 PM |
".Pistol-(12)" Hyphens are not allowed for keys in this format, and neither are parentheses. |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2014 05:11 PM |
So my hunch of the name messing with it was correct? Thats oddly encouraging. So, new problem, does anyone know how I could work around this issue? Any ideas?
Also, thank you for the help. Much appreciated. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 26 Nov 2014 05:15 PM |
| Use ["Pistol-(12)"] instead of .Pistol-(12) |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2014 05:14 AM |
| I am afraid this did not fix it. If anyone can offer anymore insight that would be great. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 05 Jan 2015 05:18 PM |
| Can seriously no one help with this? |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2015 01:08 PM |
Please could someone help me out with this? Please Pretty please |
|
|
| Report Abuse |
|
|