I have made a blink script for my game, and that's all good and it works perfectly, however, there is a thing that is not working, I am using the blink mechanic for make enemies move when you blink so they can snap your neck, but the script doesn't seem to realize when the blink frame's BackgroundTransparency value goes to 0, which takes only 0.15s (I also tried to make it 0.5-1s)
while true do local Blink = game.StarterGui.BlinkGui.BlinkMeter.BlinkCastFrame.BackgroundTransparency == 0 --the local value ---------------------------- if minply and not beingwatched and canSee2(script.Parent.Parent, minply.Parent) or minply and canSee2(script.Parent.Parent, minply.Parent) and Blink == true then --Blink == true is the part I am talking about, focus on that if minmag and minmag <= 99999 then local unit = (script.Parent.Position-minply.Position).unit unit = Vector3.new(unit.X,0,unit.Z) script.Parent.CFrame = CFrame.new(script.Parent.Position + (unit*-1), Vector3.new(minply.Position.X, script.Parent.Position.Y, minply.Position.Z)) script.Parent.Slide:Play() if minmag < 5 and minply.Parent:FindFirstChild("Humanoid") and minply.Parent.Humanoid.Health > 0 then minply.Parent:FindFirstChild("Humanoid"):TakeDamage(9999) local SelectedAttackList = {"NeckSnap1", "NeckSnap2", "NeckSnap3"}; local SelectedAttackSound = script.Parent[math.random(1, #SelectedAttackList)]; SelectedAttackSound:Play()end end end Wait(0) script.Parent.Slide:Pause() --This is the enemy's final script phase end
When I change the BackgroundTransparency value to 1 (which means you aren't blinking) in the local value, the enemy moves, but when I change it to 0 (what I want, it means you are blinking) it won't work, despite the frame having the correct value (0).
This is the Blink script phase where the Frame becomes transparent with a nice effect instead of going straight dark:
if Blink == true then while (BlinkCast.BackgroundTransparency > 0) do wait(0.01) BlinkCast.BackgroundTransparency = BlinkCast.BackgroundTransparency - 0.333 end BlinkCast.BackgroundTransparency = 0 wait(0.15) while (BlinkCast.BackgroundTransparency < 1) do wait(0.01) BlinkCast.BackgroundTransparency = BlinkCast.BackgroundTransparency + 0.333 end BlinkCast.BackgroundTransparency = 1
The local value as I said works perfectly when changing it to ''BlinkCastFrame.BackgroundTransparency == 0'' So I can't seem to find the solution to fix this problem.