So I made this script, I added the fade out, but it comes with the error
Workspace.Stick.In:25: attempt to index global 'hit' (a nil value)
I know that that means It doesn't know what 'hit' is, but it's at the top of the script.
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local notice = player.PlayerGui.Notice.Notice
for i=1,0, -0.1 do
wait(0.1)
notice.Text = "You Found a Branch"
notice.BackgroundTransparency = i
notice.TextTransparency = i
notice.ImageLabel.ImageTransparency = i
end
end
end)
wait(3)
local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local notice = player.PlayerGui.Notice.Notice
for i=1,0, -0.1 do
wait(0.1)
notice.BackgroundTransparency = i
notice.TextTransparency = i
notice.ImageLabel.ImageTransparency = i
notice.Text = ""
end
