✓ Accepted answer
Here's what you can do:
local prompt = script.Parent
open = false
prompt.Triggered:Connect(function(player)
local plrGui = player:FindFirstChild("PlayerGui")
local scrGui = plrGui.ScreenGui
local Frame = scrGui.Frame
if open = false then
open = true
Frame.Visible = true
delay(3, function()
Frame.Visible = false
open = false
end)
else
return
end
end)
However, changing client-sided things on a server script can cause errors. Instead, place a local script in StarterGui, or StarterPlayerScripts.
afterwards, add a RemoteEvent. You should place in ReplicatedStorage.
then change the server script (normal script) to be this:
local prompt = script.Parent
open = false
prompt.Triggered:Connect(function(player)
if open = false then
local waittime = 3
open = true
game.ReplicatedStorage.RemoteEvent:FireClient(player,waittime)
wait(waittime)
open = false
else
return
end
end)
Finally in the local script, put this:
local Event = game.ReplicatedStorage.RemoteEvent
local player = game.Players.LocalPlayer
Event.OnClientEvent:Connect(function(waittime)
local plrGui = player.PlayerGui
local scrGui = plrGui.ScreenGui
local frame = scrGui.Frame
frame.Visible = true
wait(waittime)
frame.Visible = false
end)
1 comment
You have to use a remote event I believe, because you can't and (shouldn't change) guis on the server