Help with a easy script

Hello, I’am the devloper of Danger District, my little issue its the next, I got an tp script, I wanna do when u tp to the position the screen makes black for few sec…

The script for tp:
local function onClicked()
local Players = game.Players:GetPlayers()
for _, Player in pairs(Players) do
if Player.Character then
Player.Character:MoveTo(Vector3.new(-508.431, 1.3, -307.572))
end
end
end

script.Parent.ClickDetector.MouseClick:Connect(onClicked)
(Made by jackscarlett)

You would just reference the player’s PlayerGui:

function on_Clicked(player) -- // Yes, MouseClick returns the player who clicked it.
    local playerGui = player:FindFirstChild("PlayerGui");
end

clickDetector.MouseClick:Connect(mouse_Click)

And you would do the rest.
Edit: Sorry for bad typing, I am on mobile.

What do I need to do for it works? add a gui black and unenable it on playergui??

You would have to reference your gui object, and do anything with it.

i dont know script but thanks u anyways.

(I accidentally clicked the like button)
Sometimes you need to figure out the coding yourself, you can’t just have other people do it for you

I dont relly know english for know what he says but ok, ty

function on_Clicked(player) – // Yes, MouseClick returns the player who clicked it.
local playerGui = player:FindFirstChild(“PlayerGui”);
end

clickDetector.MouseClick:Connect(mouse_Click)
then GetService(‘Players’).LocalPlayer:WaitForChild(‘PlayerGui’)

ill try but idk if it works,its 0am for me so ill go sleep