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

in this code below, the gui doesn't appear??

Asked by 4 years ago
local tool = script.Parent
local event = game.ReplicatedStorage.StrengthEvent
local debounce = false
local plr = game.Players.LocalPlayer
local waitGui = plr.PlayerGui:WaitForChild("ScreenGui")
local gui = waitGui.Strength.TextTransparency

tool.Activated:Connect(function()
    if not debounce then
        debounce = true
        for i = 1, 0, .1 do
            gui = i
            wait()
        end
        wait()
        event:FireServer()
        wait(2)
        for i = 1, 0, -.1 do
            gui = i
            wait()
        end
        debounce = false
    end 
end)

the gui doesn't appear... im not sure what to do e.e and i had to expand the title.

0
i think im overusing waits though lol queue0I 5 — 4y
0
Maybe you want to accept my answer? If you could, I'm appreciated. :)) LinavolicaDev 570 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Your code has several problems.

  1. gui = waitGui.Strength.TextTransparency, well use waitGuit.Strength.

  2. for i = 1, 0, .1 do, you cannot count down from 1 to 0 per 0.1.

I fixed your code; Hope it helps.

local tool = script.Parent
local event = game.ReplicatedStorage.StrengthEvent
local debounce = false
local plr = game.Players.LocalPlayer
local waitGui = plr.PlayerGui:WaitForChild("ScreenGui")
local gui = waitGui.Strength

tool.Activated:Connect(function()
    if not debounce then
        debounce = true
        for i = 0, 1, .1 do
            gui.TextTransparency = i
            wait()
        end
        wait()
        event:FireServer()
        wait(2)
        for i = 1, 0, -.1 do
            gui.TextTransparency = i
            wait()
        end
        debounce = false
    end 
end)

0
ah thanks, it definitely helps. i just started coding a week ago :) queue0I 5 — 4y
Ad

Answer this question