So i am making a fishing pole that casts a line through making them transparent and then not again. So this works great but my problem is, when I want the tool to be activated again after its initial activation, I want the line to real back in. But I don't know how I could make it so the tool can be activated, then activated again, completing a second task.
This is what I have:
01 | Tool.Activated:connect( function () |
02 | SlashAnimLoaded:Play() --pay no attention to this stuff, it isn't realavant. |
03 | Tool.A.Transparency = 1 -- also Tool is script.Parent |
04 | Tool.B.Transparency = 0 |
05 | wait( 0.1 ) |
06 | Tool.C.Transparency = 0 |
07 | Tool.B.Transparency = 1 |
08 | wait( 0.1 ) |
09 | Tool.D.Transparency = 0 |
10 | Tool.C.Transparency = 1 |
11 | wait( 0.1 ) |
12 | Tool.E.Transparency = 0 |
13 | Tool.D.Transparency = 1 |
14 | --Don't know what to put here |
15 | Tool.A.Transparency = 0 |
16 | Tool.B.Transparency = 1 |
17 | Tool.C.Transparency = 1 |
18 | Tool.D.Transparency = 1 |
19 | Tool.E.Transparency = 1 |
20 | end ) |
There is a very simple way you can do this. Here is one way, there may be others.
You could put an IntValue or NumberValue in this tool, then name it "Equips" or whatever you'd like. Then on equip, add 1 to the value, then check with an if
. You will want to subtract 1 from the Value on the second try so it goes back to the first one!
This is what your finished script should look like:
01 | Tool.Activated:connect( function () |
02 | SlashAnimLoaded:Play() --pay no attention to this stuff, it isn't realavant. |
03 | Tool.A.Transparency = 1 -- also Tool is script.Parent |
04 | Tool.B.Transparency = 0 |
05 | wait( 0.1 ) |
06 | Tool.C.Transparency = 0 |
07 | Tool.B.Transparency = 1 |
08 | wait( 0.1 ) |
09 | Tool.D.Transparency = 0 |
10 | Tool.C.Transparency = 1 |
11 | wait( 0.1 ) |
12 | Tool.E.Transparency = 0 |
13 | Tool.D.Transparency = 1 |
14 | if script.Parent.IntValue.Value = = 2 then |
15 | Tool.A.Transparency = 0 |
Now, it's very important you have the value change at first where I put it because if it's before the script hits the If, then it will activate what should happen on second equip the first time. You may have to change the hierarchy and if you want this to stay as the second equip part, remove where value become 1 again!
If this helped, Up vote and Accept! Ask questions if it doesn't work or if you're confused!
01 | local 2 ndTime = false |
02 |
03 | Tool.Activated:connect( function () |
04 | if not 2 ndTime then |
05 | SlashAnimLoaded:Play() --pay no attention to this stuff, it isn't realavant. |
06 | Tool.A.Transparency = 1 -- also Tool is script.Parent |
07 | Tool.B.Transparency = 0 |
08 | wait( 0.1 ) |
09 | Tool.C.Transparency = 0 |
10 | Tool.B.Transparency = 1 |
11 | wait( 0.1 ) |
12 | Tool.D.Transparency = 0 |
13 | Tool.C.Transparency = 1 |
14 | wait( 0.1 ) |
15 | Tool.E.Transparency = 0 |