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:
Tool.Activated:connect(function() SlashAnimLoaded:Play()--pay no attention to this stuff, it isn't realavant. Tool.A.Transparency = 1-- also Tool is script.Parent Tool.B.Transparency = 0 wait(0.1) Tool.C.Transparency = 0 Tool.B.Transparency = 1 wait(0.1) Tool.D.Transparency = 0 Tool.C.Transparency = 1 wait(0.1) Tool.E.Transparency = 0 Tool.D.Transparency = 1 --Don't know what to put here Tool.A.Transparency = 0 Tool.B.Transparency = 1 Tool.C.Transparency = 1 Tool.D.Transparency = 1 Tool.E.Transparency = 1 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:
Tool.Activated:connect(function() SlashAnimLoaded:Play()--pay no attention to this stuff, it isn't realavant. Tool.A.Transparency = 1-- also Tool is script.Parent Tool.B.Transparency = 0 wait(0.1) Tool.C.Transparency = 0 Tool.B.Transparency = 1 wait(0.1) Tool.D.Transparency = 0 Tool.C.Transparency = 1 wait(0.1) Tool.E.Transparency = 0 Tool.D.Transparency = 1 if script.Parent.IntValue.Value == 2 then Tool.A.Transparency = 0 Tool.B.Transparency = 1 Tool.C.Transparency = 1 Tool.D.Transparency = 1 Tool.E.Transparency = 1 script.Parent.IntValue.Value = 1 end script.Parent.IntValue.Value = 2 -- Actually Less typing by setting it this way, not adding end)
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!
local 2ndTime = false Tool.Activated:connect(function() if not 2ndTime then SlashAnimLoaded:Play()--pay no attention to this stuff, it isn't realavant. Tool.A.Transparency = 1-- also Tool is script.Parent Tool.B.Transparency = 0 wait(0.1) Tool.C.Transparency = 0 Tool.B.Transparency = 1 wait(0.1) Tool.D.Transparency = 0 Tool.C.Transparency = 1 wait(0.1) Tool.E.Transparency = 0 Tool.D.Transparency = 1 else Tool.A.Transparency = 0 Tool.B.Transparency = 1 Tool.C.Transparency = 1 Tool.D.Transparency = 1 Tool.E.Transparency = 1 -- if you want to, once you activate a third time, do like the first: 2ndTime = false end)