Hello, this is my first topic I’m ever writing.
I am trying to make text show up after clicking a part by using a function and then calling it when needed, which shouldn’t be too hard but for me unfortunately it is.
Here is my code.
local tweenservice = game:GetService("TweenService")
local runservice = game:GetService("RunService")
local Gui = game:GetService("StarterGui"):WaitForChild("ItemInf")
local Text = Gui:WaitForChild("TextLabel")
----
local function ShowText()
print("Showing Text")
for i = 1,100 do
Text.TextTransparency -=0.01
wait(0.01)
end
for i = 1,30 do
Text.BackgroundTransparency -=0.01
wait(0.1)
end
end
local function HideText()
print("Hiding Text")
for i = 1,70 do
Text.BackgroundTransparency +=0.01
wait(0.01)
end
for i = 1,100 do
Text.TextTransparency +=0.01
wait(0.01)
end
end
----
local model = script.Parent
local cD = model.ClickDetector
local IsDisplaying = false
local highlight = Instance.new("Highlight")
highlight.Parent = model
highlight.OutlineTransparency = 1
highlight.FillTransparency = 1
cD.MouseHoverEnter:Connect(function()
local goaltween = {}
goaltween.OutlineTransparency = 0
local tI = TweenInfo.new(0.5, Enum.EasingStyle.Quint)
tweenservice:Create(highlight, tI, goaltween):Play()
end)
cD.MouseHoverLeave:Connect(function()
local goaltween = {}
goaltween.OutlineTransparency = 1
local tI = TweenInfo.new(0.5, Enum.EasingStyle.Quint)
tweenservice:Create(highlight, tI, goaltween):Play()
end)
cD.MouseClick:Connect(function()
if IsDisplaying == false then
ShowText()
wait(8)
HideText()
IsDisplaying = false
end
end)
The issue is that after i click my part when i check the GUI values I can see them changing the transparency to 0 but for some reason the text doesn’t show up.
I would greatly appreciate any help.