Hi Other Developers,
I am fairly new to scripting and have been running into this issue where my ImageLabel does not show but I don’t know why.
What I want to achieve is to have the ImageLabel to show after touching it.
But It doesn’t show when I try to make it appear on screen.
Here is the Current Script I’m using:
local PartHit = script.Parent
local CoolDown = false
PartHit.TouchEnded:Connect(function(Hit)
local Char = Hit.Parent
local Humanoid = Char:FindFirstChild("Humanoid")
if Humanoid == nil then
warn("Humanoid Not Found")
else
if CoolDown == false then
CoolDown = true
local JumpScare = game.StarterGui.JumpScare.ImageLabel
JumpScare.ImageTransparency = 0
task.wait(3)
JumpScare.ImageTransparency = 1
task.wait(25)
CoolDown = false
end
end
end)
The problem is you are getting the ImageLabel from “StarterGui”
StarterGUI is copied into the Player object when a character loads.
You need to look in game.Players.LocalPlayer.PlayerGUI
local PartHit = script.Parent
local CoolDown = false
PartHit.TouchEnded:Connect(function(Hit)
local Char = Hit.Parent
local Humanoid = Char:FindFirstChild("Humanoid")
if Humanoid == nil then
warn("Humanoid Not Found")
else
if CoolDown == false then
CoolDown = true
local JumpScare = game.Players[Char.Name].PlayerGui.JumpScare.ImageLabel
JumpScare.ImageTransparency = 0
task.wait(3)
JumpScare.ImageTransparency = 1
task.wait(25)
CoolDown = false
end
end
end)
local JumpScare = game.Players[Char.Name].PlayerGui.JumpScare.ImageLabel
StarterGui is only for when the player respawn by example, you need to directly get the Gui from the player