Hello there,
I am working on a horror game,
I have a meshpart called “Walkie Talkie” and I am trying to use a proximity prompt to make a an image frame visible the after five seconds, invisible.
local WalkieTalkie = script.Parent
local screenGuiPath = game.StarterGui:WaitForChild("ScreenGui")
local imageLabel = screenGuiPath:WaitForChild("ImageLabel")
game.Workspace.WalkieTalkie.ProximityPrompt.Triggered:Connect(function(playerWhoTriggered)
if playerWhoTriggered:IsA("Player") then
imageLabel.Visible = true
wait(5)
imageLabel.Visible = false
end
end)
If anyone could help me, I would extremely grateful.
I would use this as a local script inside the gui itself as it is for the client.
local WalkieTalkie = workspace:WaitForChild("WalkieTalkie", 1)
local Prompt = WalkieTalkie:WaitForChild("ProximityPrompt", 1)
local Gui = script.Parent
local ImageLabel = Gui:WaitForChild("ImageLabel", 1)
Prompt.Triggered:Connect(function(player: Player)
if player ~= game:GetService("Players").LocalPlayer then return end
ImageLabel.Visible = true
task.wait(5)
ImageLabel.Visible = false
end)