|
| 10 May 2014 08:50 PM |
The issues are self explanatory on the script if you are experienced.
Before you read on, here are some clues I found inside the console if it proves useful--
18:47:31.872 - Players.Player1.Backpack.C4.Script:19: attempt to index global 'C4' (a nil value)
Script;
function onMouseClick1() Instance.new('Part', Workspace) Instance.new('Decal', Workspace.Part) Instance.new('Decal', Workspace.Part) Workspace.Part.Position = Workspace.Player1.Head.Position Workspace.Part.Size = Vector3.new(2, 1.2, 2) Workspace.Part.BottomSurface = "SmoothNoOutlines" Workspace.Part.TopSurface = "SmoothNoOutlines" Workspace.Part.Decal.Texture = "http://www.roblox.com/asset/?id=149185724" Workspace.Part.Decal.Name = "d1" Workspace.Part.Decal.Name = "d2" Workspace.Part.d1.Texture = "http://www.roblox.com/asset/?id=149185724" Workspace.Part.d2.Texture = "http://www.roblox.com/asset/?id=149185724" Workspace.Part.d1.Face = "Bottom" Workspace.Part.d2.Face = "Top" Workspace.Part.BrickColor = BrickColor.Yellow() C4:Destroy() end
C4.MouseClick1:connect(onMouseClick1) |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 08:51 PM |
| The variable for "C4" is not correct |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 May 2014 09:21 PM |
Oops, "C4.MouseButton1Click:connect(onClick)" |
|
|
| Report Abuse |
|
|
tery215
|
  |
| Joined: 19 Aug 2009 |
| Total Posts: 3879 |
|
|
| 10 May 2014 09:31 PM |
use :Remove()
also, that's an unreliable system you got there |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 10:14 PM |
@tery215 I know. It's just an experiment. I'm still a noob at Lua but I mostly enjoy it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 May 2014 10:44 PM |
| Would someone then kindly rewrite the script for me? It's getting confusing for me now... |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 10 May 2014 10:45 PM |
| You never told the script what "C4" is |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 10:52 PM |
@128GB
C4 Is the tool inside your character. I did this so it would limit to only one C4. |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
| |
|
|
| 10 May 2014 10:58 PM |
@wazap
I recently made changes to my script--
Tool = Workspace:findFirstChild("Model") --finds the model of the player if Workspace.Model ~= true then
function onClick() Instance.new('Part', Workspace) Instance.new('Decal', Workspace.Part) Instance.new('Decal', Workspace.Part) Workspace.Part.Position = Workspace.Player1.Head.Position Workspace.Part.Size = Vector3.new(2, 1.2, 2) Workspace.Part.BottomSurface = "SmoothNoOutlines" Workspace.Part.TopSurface = "SmoothNoOutlines" Workspace.Part.Decal.Texture = "http://www.roblox.com/asset/?id=149185724" Workspace.Part.Decal.Name = "d1" Workspace.Part.Decal.Name = "d2" Workspace.Part.d1.Texture = "http://www.roblox.com/asset/?id=149185724" Workspace.Part.d2.Texture = "http://www.roblox.com/asset/?id=149185724" Workspace.Part.d1.Face = "Bottom" Workspace.Part.d2.Face = "Top" Workspace.Part.BrickColor = BrickColor.Yellow() Script.Parent.Parent.C4:Remove() end end
Tool.C4.MouseButton1Click:connect(onClick) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 10 May 2014 10:59 PM |
"Tool = Workspace:findFirstChild("Model") --finds the model of the player"
No, it finds a object in the workspace named Model. Not the character. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:05 PM |
@128GB
Well all I can think of is a Touched event that can gain access to the user...
function onTouched(hit) print(hit.Parent) end
Workspace.Part.Touched:connect(onTouched)
But it wouldn't make sense... |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 10 May 2014 11:06 PM |
script.Parent -- this is the tool script.Parent.Parent -- this is the character |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:06 PM |
I also want to know how to make the "MouseButton" a bindable function to execute the script.
|
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:09 PM |
I tried that, which resulted in this--
21:08:11.437 - Players.Player1.Backpack.C4.Script:1: attempt to index global 'Script' (a nil value) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
|
| 10 May 2014 11:17 PM |
C4 = script.Parent
function onMouseClick1() p = Instance.new('Part', Workspace) d1 = Instance.new('Decal', Workspace.Part) d2 = Instance.new('Decal', Workspace.Part) p.Position = Char.Head.Position p.Size = Vector3.new(2, 1.2, 2) p.BottomSurface = "SmoothNoOutlines" p.TopSurface = "SmoothNoOutlines" d1.Texture = "http://www.roblox.com/asset/?id=149185724" d1.Name = "d1" d2.Name = "d2" d1.Texture = "http://www.roblox.com/asset/?id=149185724" d2.Texture = "http://www.roblox.com/asset/?id=149185724" d1.Face = "Bottom" d2.Face = "Top" p.BrickColor = BrickColor.Yellow() C4:Destroy() end
C4.Equipped:connect(function(Mouse) Char = C4.Parent Mouse.Button1Down:connect(onMouseClick1) end)
|
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:22 PM |
C4 = script.Parent
function onMouseClick1() p = Instance.new('Part', Workspace) d1 = Instance.new('Decal', p) d2 = Instance.new('Decal', p) p.Position = Char.Head.Position p.Size = Vector3.new(2, 1.2, 2) p.BottomSurface = "SmoothNoOutlines" p.TopSurface = "SmoothNoOutlines" d1.Texture = "http://www.roblox.com/asset/?id=149185724" d1.Name = "d1" d2.Name = "d2" d1.Texture = "http://www.roblox.com/asset/?id=149185724" d2.Texture = "http://www.roblox.com/asset/?id=149185724" d1.Face = "Bottom" d2.Face = "Top" p.BrickColor = BrickColor.Yellow() C4:Destroy() end
C4.Equipped:connect(function(Mouse) Char = C4.Parent Mouse.Button1Down:connect(onMouseClick1) end)
|
|
|
| Report Abuse |
|
|
|
| 11 May 2014 10:18 PM |
| Thanks for the working script islandmaker2012. |
|
|
| Report Abuse |
|
|