How to make flashbang type of effect


Hello i was experimenting and found out how to create a flashbang type of effect and decided to share it with yall, it may be delayed on phone/poor pc so i only recommend enabling its usage if user has 8-9+ graphics enabled in settings.
heres a code snippet:

UserInputService.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.KeyCode == Enum.KeyCode.G then
		CaptureService:CaptureScreenshot(function(contentId)
			Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("ImageLabel").Image = contentId
			Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("ImageLabel").ImageTransparency = 0 
			TweenService:Create(Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("ImageLabel"), TweenInfo.new(5), {ImageTransparency=  1}):Play()
		end)
	end
end)

It uses capture service to create a screenshot and then uses its temporary content id to display it on a screengui image label with screeninsets and area compitability set to none. good luck implementing that into your game!

9 Likes

If youre wondering about this waitforchild mess im just lazy to code well here cuz its a hackweek place