smunkeyJoin Date: 2011-12-17 Post Count: 342 |
I have made this script that goes in a frame. The number starts as zero but increases by one every time you click a block. (In a separate working script there is '_G.lpc = 50' and '_G.grain = 0'. However, the textlabel will only output the original _G.grain value and then only change when you change it manually.
while _G.grain>0 do
script.Parent.Parent.TextLabel.Text = _G.grain
wait(1)
end
in the blocks are this script. There are 108 of these blocks.
function onClicked()
_G.grain = _G.grain + 1
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Neither of the scripts output errors in the script or output. What is wrong and how do I fix it? |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
bump
|
|
ZawieJoin Date: 2010-07-04 Post Count: 6338 |
Erm check if the block/script is in the right place.
Acording to this this block is in GUi... |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
The block scripts are inside the correct spot (inside the part you click on) and are not in the gui, they just sorta sit around on the map. |
|
ZawieJoin Date: 2010-07-04 Post Count: 6338 |
Where is the script? |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
The first script is in a textlabel, in a frame, in the startergui
the second script is in a part, in a model, in the workspace |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
I'm guessing I spelt/wrote this line of script wrong, but I have no idea how to fix it.
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
.Clicked() |
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
while true do
script.Parent.Parent.TextLabel.Text = _G.grain
wait(1)
end |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
I don't know if this helps, but next to the click for more grain script is this script that makes the block it is in invisible for 300 seconds.
function onClicked()
script.Parent.CanCollide = false
script.Parent.Transparency = 1
debounce = false
wait(300)
debounce = true
script.Parent.CanCollide = true
script.Parent.Transparency = 0
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
This one is in a normal script, and it works perfectly fine. But I am guessing there might be something in this script interfering with the loclascript |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
These are some of the very early versions of the script if you want to mess with those.
The GUI: http://www.roblox.com/broken-backpack-item?id=170198810
The block: http://www.roblox.com/space-wheat-item?id=169455421
(delete 8 of the yellow rods called 'grain' to make testing easier) |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
Play around with printing in the output to see when the script stops |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
I finished fixed it, thanks for all the help. |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
Nevermind, this script will work while testing it in studio, but not in an actaul game.
function clicked()
local g = _G.grain
g = g + 1
_G.grain = g
end
script.Parent.ClickDetector.MouseClick:connect(clicked)
|
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
The above script is in a normal script, I tried moving it to a localscript but it wouldn't even work in studio when I did that.
|
|
LacrymaJoin Date: 2010-02-15 Post Count: 22696 |
repeat wait() until (_G.grain ~= nil)
function clicked()
_G.grain = _G.grain + 1
end
script.Parent.ClickDetector.MouseClick:connect(clicked) |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
That doesn't work, thanks for trying anyways. Anyways, it may have something to do with having two different kinds of scripts in a single brick, or it might be something to do with localscripts and clickdetectors. |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
This script has me stumped, I give up on it for now. If you give me a script that doesn't work I will still mess around with it a bit. |
|