Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making debounce on loop ? ? *PLS HELP*

Asked by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago

So i've made a script that once u draw ur sword near an enemy, sword script tags that an enemy is nearby also, makes gui visible to show it's health.

Also i got a sound that suppost to play once the tag is ~=nil. but it loops trough .... How do i make Debounce to the Sound play script like once the tag gets ~=nil then make the sound play for ONCE not looping trough and once the gui disappears it should stop playing if the tag is ==nil all it does now is loop :-;

local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui.EnemyInfo
GUI.EnemyBar:WaitForChild("Tag")

while true do
    if GUI.EnemyBar.Tag.Value ~= nil then
    script.Parent.Battle:Play()
    for i = 1,25 do
    script.Parent.Battle.Volume = script.Parent.Battle.Volume + 0.01
    wait(0.01)
end

elseif GUI.EnemyBar.Tag.Value == nil then

for i = 1,25 do
    script.Parent.Battle.Volume = script.Parent.Battle.Volume - 0.01
    wait(0.01)
    script.Parent.Battle:Stop()
    end
    end
end
0
You need to further clarify the issue. You are not making any sense and I believe that is why nobody has answered yet. Try to act professional and explain reasonably. voximity 75 — 7y

Answer this question