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

Why isn't my ImageLabel fading out/disapearing?

Asked by
Burobuu 18
3 years ago

I'm working on my killed by GUI and for some reason, it wouldn't fade out after fading in. I got rid of the entire fade-out loop and just made it disappear but it still wouldn't go away. I was trying to have it disappear once the player respawns but that wouldn't work either. I plan to have this repeat every time the player is killed, not sure if that'd work though because it doesn't disappear. Thanks in advance!

At the moment I have it fade in, display the player's killer, and disappear. (Stays and doesn't go away)

LocalScript > TextLabel > ImageLabel > Frame > ScreenGui

The code below is a local script under the TextLabel.

local event = game.ReplicatedStorage.KilledEvent
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
script.Parent.Parent.ImageTransparency=1
script.Parent.Parent.Parent.Visible=false

event.OnClientEvent:Connect(function(plr, killerName)
    if killerName and plr.Name then
        if plr.Name == character.Name then
            script.Parent.Text=killerName
            script.Parent.Parent.Parent.Visible=true
            repeat

                script.Parent.Parent.ImageTransparency = script.Parent.Parent.ImageTransparency - 0.05
                wait(0.1)

            until script.Parent.Parent.ImageTransparency == .3
            wait(6)
            script.Parent.Parent.ImageTransparency=1
            script.Parent.Parent.Parent.Visible=false
        end
    end
end)

1 answer

Log in to vote
0
Answered by 3 years ago

here, try this, hope it works! also, it has an better fade in / fade out effect!

local event = game.ReplicatedStorage.KilledEvent
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
script.Parent.Parent.ImageTransparency=1
script.Parent.Parent.Parent.Visible=false

local tweenServ = game:GetService("TweenService")

event.OnClientEvent:Connect(function(plr, killerName)
    if killerName and plr.Name then
        if plr.Name == character.Name then
            script.Parent.Text=killerName
            script.Parent.Parent.Parent.Visible=true
local tweeninfo = TweenInfo.new(2)
local tween = tweenServ:Create(script.Parent.Parent,tweeninfo,{ImageTransparency=0})
tween:Play()
tween.Completed:wait()
       wait(6)
local tween2 = tweenServ:Create(script.Parent.Parent,tweeninfo,{ImageTransparency=1})
tween2:Play()
tween2.Completed:wait()

            script.Parent.Parent.Parent.Visible=false
        end
    end
end)
Ad

Answer this question