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

Transparency values of instance not being changed?

Asked by 3 years ago

This question has been solved by the original poster.

I have a script that uses a RemoteEvent to cause the transparency of some TextLabels to fade out, I can get the first one to, but when it comes onto the second, nothing happens, it doesn't even continue on after the first fade, I am finding the second TextLabel using instances and I tested if it actually finds the second TextLabel and it does. Could someone point out what I'm doing wrong?

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")

local StarterGui = game:GetService("StarterGui")

local Menu = StarterGui:FindFirstChild("Menu")

local Text2 = Menu:FindFirstChild("Text2")

local TweenService = game:GetService('TweenService')
local function guitween()

    wait(3)
    TweenService:Create( script.Parent, TweenInfo.new(2), {BackgroundTransparency = 1}):Play()
    TweenService:Create( script.Parent, TweenInfo.new(2), {TextTransparency = 1}):Play()
    wait(7)
    TweenService:Create( Text2, TweenInfo.new(2), {BackgroundTransparency = 1}):Play()
    TweenService:Create( Text2, TweenInfo.new(2), {TextTransparency = 1}):Play()
end

RemoteEvent.OnClientEvent:Connect(guitween)

1 answer

Log in to vote
0
Answered by 3 years ago

Nvm, I solved it, I had the local script in the first TextLabel, when I should have had it in the Gui Itself. I just changed the script to find it's parents children then changed the children's transparency.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")

local Text1 = script.Parent:FindFirstChild("Text1")

local Text2 = script.Parent:FindFirstChild("Text2")

local TweenService = game:GetService('TweenService')
local function guitween()

    wait(3)
    TweenService:Create( Text1, TweenInfo.new(2), {BackgroundTransparency = 1}):Play()
    TweenService:Create( Text1, TweenInfo.new(2), {TextTransparency = 1}):Play()
    wait(10)
    TweenService:Create( Text2, TweenInfo.new(2), {BackgroundTransparency = 1}):Play()
    TweenService:Create( Text2, TweenInfo.new(2), {TextTransparency = 1}):Play()
end

RemoteEvent.OnClientEvent:Connect(guitween)
Ad

Answer this question