janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 04:18 PM |
There's nothing telling me what's wrong with it, it just says it stops there.
--Player = Game.Players.LocalPlayer mouse = Player:GetMouse()--Problem here BP=script.Parent.BP x=game.Workspace.Quaternary.num1.Value y=game.Workspace.Quaternary.num2.Value z=game.Workspace.Quaternary.num3.Value q=game.Workspace.Quaternary.num4.Value j=game.Workspace.Quaternary.num5.Value function click() if mouse.Target and mouse.Target.Name == "Quaternary" then if x==0 then x=BP elseif x~=0 then if y==0 then y=BP elseif y~=0 then if z==0 then z=BP elseif z~=0 then if q==0 then q=BP elseif q ~= 0 then j=BP elseif j~=0 then j=j end end end end end end
script.Parent.Selected:connect(function(mouse) end) mouse.Button1Down:connect(function(click) end)--
I have 5 NumberValues in a block called Quaternary. They're supposed to change when I click on it with this tool. I have no idea what's wrong with it, can someone help, please? |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 04:19 PM |
Use mine as a ref.
myMouse = game.Players.LocalPlayer:GetMouse() myMouse.Button1Down:connect(function() if myMouse.Target then local part= myMouse.Target if part.Name == "Part" then print "I clicked the right brick" end end end) |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 10 May 2013 04:20 PM |
| Line one is shown as a comment. That's why player is undefined. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 04:37 PM |
@Force: Line 1 isn't a comment, I did that so you could see where the script starts and ends. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 04:45 PM |
I now have this:
BP=script.Parent.BP x=game.Workspace.Quaternary.num1.Value y=game.Workspace.Quaternary.num2.Value z=game.Workspace.Quaternary.num3.Value q=game.Workspace.Quaternary.num4.Value j=game.Workspace.Quaternary.num5.Value function click() if mouse.Target and mouse.Target.Name == "Quaternary" then if x==0 then x=BP elseif x~=0 then if y==0 then y=BP elseif y~=0 then if z==0 then z=BP elseif z~=0 then if q==0 then q=BP elseif q ~= 0 then j=BP elseif j~=0 then j=j print("Works!") end end end end end end
Zero output. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 04:54 PM |
This one, sorry.
myMouse = game.Players.LocalPlayer:GetMouse() myMouse.Button1Down:connect(function() if myMouse.Target then local part= myMouse.Target if part.Name == "Quaternary" then if x==0 then x=BP elseif x~=0 then if y==0 then y=BP elseif y~=0 then if z==0 then z=BP elseif z~=0 then if q==0 then q=BP elseif q ~= 0 then j=BP elseif j~=0 then j=j print("Works!") end end end end end end end)
No output. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 05:06 PM |
BP=script.Parent.BP x=game.Workspace.Quaternary.num1.Value y=game.Workspace.Quaternary.num2.Value z=game.Workspace.Quaternary.num3.Value q=game.Workspace.Quaternary.num4.Value j=game.Workspace.Quaternary.num5.Value myMouse = game.Players.LocalPlayer:GetMouse() myMouse.Button1Down:connect(function() if myMouse.Target then local part= myMouse.Target if part.Name == "Quaternary" then print("test") --Doesn't run. if x==0 then x=BP elseif x~=0 then if y==0 then y=BP elseif y~=0 then if z==0 then z=BP elseif z~=0 then if q==0 then q=BP elseif q ~= 0 then j=BP elseif j~=0 then j=j print("Works!")--Also doesn't run end end end end end end end)
Now it's not printing at all. |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 10 May 2013 05:10 PM |
| All LocalScripts need a wait() at the top. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 05:14 PM |
@1Top I added that and it's still not outputting. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 05:17 PM |
Wait, it's outputting the test, but it's not doing anything. Anyone know how to make the main part work?
if part.Name == "Quaternary" then if x==0 then x=BP elseif x~=0 then if y==0 then y=BP elseif y~=0 then if z==0 then z=BP elseif z~=0 then if q==0 then q=BP elseif q ~= 0 then j=BP elseif j~=0 then j=j
I want it to go through a list of NumberValues and change the first one that is 0 to the value stored in BP. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 05:31 PM |
I may have caused an infinite loop by giving the variable the same name as its target. Still not working, though. I have to go for now but help would be greatly appreciated. |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 05:39 PM |
I'm thinking that you just put your ends in the wrong places xP
if x==0 then x=BP elseif x~=0 then if y==0 then y=BP end--Add an end elseif y~=0 then if z==0 then z=BP end--Add an end elseif z~=0 then if q==0 then q=BP end--Add an end elseif q ~= 0 then j=BP elseif j~=0 then j=j |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 10:39 PM |
@Screw It says it's expecting end near all of the if lines, and if I do that it tells me that it's expecting "eof" near elseif. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 May 2013 10:43 PM |
Okay so I got it to play the last print but it's not working when I click on Quaternary with it. Would this be easier with .touched? |
|
|
| Report Abuse |
|
|
WishNite
|
  |
| Joined: 11 Feb 2009 |
| Total Posts: 15828 |
|
|
| 10 May 2013 11:06 PM |
The problem is how you set up the x,y,z, etc variables
When you say x = IntValue.Value, it sets it to the VALUE, not the property
So if the IntValue.Value = 5, x = 5.
And then you try to edit "5", which you can't, because it's not a property.
Try this:
x = IntValue IntValue.Value = BP |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 11 May 2013 09:09 AM |
Renamed the numberValue in the tool to BPx, now I have this:
wait(.1) BP=script.Parent.BPx.Value x=game.Workspace.Quaternary.num1.Value y=game.Workspace.Quaternary.num2.Value z=game.Workspace.Quaternary.num3.Value q=game.Workspace.Quaternary.num4.Value j=game.Workspace.Quaternary.num5.Value myMouse = game.Players.LocalPlayer:GetMouse() myMouse.Button1Down:connect(function() if myMouse.Target then local part= myMouse.Target if part.Name == "Quaternary" then print("test")--Runs now if x==0 then x=BP elseif x~=0 then if y==0 then y=BP end elseif y~=0 then if z==0 then z=BP end elseif z~=0 then if q==0 then q=BP end elseif q ~= 0 then j=BP end elseif j~=0 then j=j end print("Works!") end end)
I don't exactly understand what you're trying to say, Wishnite. but it's still not working. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 11 May 2013 09:11 AM |
| The mouse is working fine, it prints when I click the block, but it's not changing the numValues. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
| |
|
|
| 11 May 2013 10:49 AM |
wait(.1) myMouse = game.Players.LocalPlayer:GetMouse() myMouse.Button1Down:connect(function() local BP=script.Parent.BPx.Value local x=game.Workspace.Quaternary.num1.Value local y=game.Workspace.Quaternary.num2.Value local z=game.Workspace.Quaternary.num3.Value local q=game.Workspace.Quaternary.num4.Value local j=game.Workspace.Quaternary.num5.Value if myMouse.Target then local part= myMouse.Target if part.Name == "Quaternary" then print("test")--Runs now if x==0 then x=BP elseif x~=0 then if y==0 then y=BP end elseif y~=0 then if z==0 then z=BP end elseif z~=0 then if q==0 then q=BP end elseif q ~= 0 then j=BP elseif j~=0 then j=j end print("Works!") end end end) |
|
|
| Report Abuse |
|
|
|
| 11 May 2013 10:50 AM |
Things I thought were wrong: Ends in wrong place Variables aren't updating everytime event is fired. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 11 May 2013 11:28 AM |
| I have it working now, thanks everyone! |
|
|
| Report Abuse |
|
|
| |
|