I have a script that makes your screen turn black every couple of seconds. I want to be able to press space and make the script make the screen turn black. Anyone know how I could do this?
Script is here just in case ya need it.
Any help?
so according to your question, you want to press Space which would make the screen go black for a few secs aka blink
you gotta use UserInputService
local input = game:GetService("UserInputService") -- sets the userinput input.InputBegan:connect(function(Blink) --calls the function if Blink.KeyCode == Enum.KeyCode.Space then -- when u press space it triggers script wait(2) -- 20 secs is a lil to long so i moved it to 2 secs for i,player in pairs(game.Players:GetChildren()) do local s=Instance.new("ScreenGui") s.Parent=player.PlayerGui local t=Instance.new("Frame") t.Size=UDim2.new(2,0,2,0) t.Position=UDim2.new(-0.5,0,-0.5,0) t.BackgroundColor3=Color3.new(0,0,0) t.ZIndex=-1 t.Parent=s delay(0.2,function() s:Destroy() end) -- replaced remove to destroy end end end)
make sure its a local script that goes into StarterCharacterScripts.
your welcome.
(i also tried this myself and it works so, if you got any errors let me know)