I dont get it. As soon as the Shoot() function starts, it INSTANTLY SKIPS THE ENTIRE WAIT! PLEASE! SOMEONE HELP! THIS IS DRIVING ME INSANE! Here is the script that is getting on my nerves....
local AllowInput = false if game.Players:GetPlayerFromCharacter(script.Parent) then AllowInput = true spawn(function() while wait() do if script:WaitForChild('ref').Value.Value ~= script:WaitForChild('ref'):WaitForChild('ref').Value.Name then script:Destroy() end end end) end function Shoot(mousepos) local object = script.Libraries.Object.LazerExample:Clone() object.Parent = script.Parent object.Position = mousepos[1] + Vector3.new(0,1024,0) for i = 0,1,-0.01 do object.Transparency = i wait(1000000000000000000000000000000000000) end print('done') if object.Parent and object then object:Destroy() end end script.Input.Value.Event:Connect(function(Action) if not AllowInput then return end if Action[1] == '1' then script:WaitForChild('ref'):WaitForChild('ref'):WaitForChild('ref').Value.Value = true Shoot(Action[2]) script:WaitForChild('ref'):WaitForChild('ref'):WaitForChild('ref').Value.Value = false --[[ script.Parent.Humanoid.WalkSpeed = 0.5 script.Parent.Humanoid.JumpPower = 0 script.Parent.GunnerAnimate.Disabled = true Shoot(Action[2]) script.Parent.GunnerAnimate.Disabled = false script.Parent.Humanoid.WalkSpeed = 16 script.Parent.Humanoid.JumpPower = 50 script:WaitForChild('ref'):WaitForChild('ref'):WaitForChild('ref').Value.Value = false ]] end end)
the wait(1000000000000000000000000000000000000) is unnecessary, the function will end and stop on its own, you dont need to extend it indefinitely. But, if you do want the wait anyway, try changing it to math.huge, math.huge is infinite
line 16
for i = 0,1,-0.01 do
When you are adding from 0 to 1 you need to add 0.01
, not substract -0.01
. This means change it to this
for i = 0,1,0.01 do
I also don't want to say something but why do you have wait(1000000000000000000000000000000000000)
? It will stop the loop for one undecillion seconds, this means one loop part will end in 12/04/292277026596 3:30pm at UTC, uh oh, that's how many years?! i think it's not exactly what you wanted to implement, notice, your loop will run ~100 times so it's ~100 undecillions seconds for one loop!