I am having trouble figuring out how I am able to create a fade GUI when a player is sitting in a seat.
My current fade script:
local part = game.Workspace.Fade
game.Players.PlayerAdded:Connect(function(plr)
local bgui = Instance.new("ScreenGui")
local bframe = Instance.new("Frame")
bgui.Parent = plr:WaitForChild("PlayerGui")
bgui.Name = "BlackoutGUI"
bframe.Parent = bgui
bframe.BackgroundTransparency = 1
bframe.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
bframe.Size = UDim2.new(10000000, 10000000, 10000000, 10000000)
end)
part.Touched:Connect(function(hit)
local activated = false
local player = hit.Parent.Name
if activated == false then
activated = true
for count = 1, 5 do
game.Players:FindFirstChild(player):WaitForChild("PlayerGui").BlackoutGUI.Frame.BackgroundTransparency = game.Players:FindFirstChild(player):WaitForChild("PlayerGui").BlackoutGUI.Frame.BackgroundTransparency - 0.050
wait(0.1)
end
activated = false
end
end)
