Lighting Effect upon touch

ive been wanting to make where when someone gets touched by something it will put a colorcorrection on their screen; but it is not working for me… this is my code

server:

hitbox.Touched:Connect(function(Hit)
	if Hit.Parent ~= Character and Hit.Parent ~= Stand then
	        local enemyplayer = players:GetPlayerFromCharacter(Hit.Parent)
		print(enemyplayer)
		blodlustremote:FireClient(enemyplayer)
	end

client:

blodlustremote.OnClientEvent:Connect(function(enemyPlayer)
	print("joe mama fatst")
	local bloodcolor = game.Lighting.Bleeding
	if enemyPlayer then
		bloodcolor.Enabled = true
	end
	print("recieved the thing")
	wait(blodcd)
	print("waited")
	bloodcolor.Enabled = false
end)

please tell me how to make my code work or give me a better method

So you wan’t to make the players screen reddish?

Change your client code to.

blodlustremote.OnClientEvent:Connect(function()
	print("joe mama fatst")
	local bloodcolor = game.Lighting.Bleeding
	
		bloodcolor.Enabled = true
	
	print("recieved the thing")
	wait(blodcd)
	print("waited")
	bloodcolor.Enabled = false
end)

Where did you define blodcd, also?

yes the player that got hit should have a reddish screen

local blodcd = 5.3

ok so uhm, nothing happened… still broken i get the error “Player Arguement Must be a Player”

You could just get a screen gui, insert a text image, change the image id to something white, and when they get hit turn the transparency to 0.8 or something.

well i know but i use color correction to seem more dynamic(like with better black outlines standing out) and to obscure their vision more.

1 Like

Change the server code to

hitbox.Touched:Connect(function(Hit)
	if Hit.Parent ~= Character and Hit.Parent ~= Stand then
	        local enemyplayer = players:GetPlayerFromCharacter(Hit.Parent)
		print(enemyplayer)
if enemyplayer then
		blodlustremote:FireClient(enemyplayer)
end
	end

now theres this error

ok, where did you put the localscript?

its in serverstorage but gets parented to starterpack

Just put it in startergui.

no that ruins my whole game. i need a script to fix it also that would literally change nothing, dont get me started with scripts dont run there; because all my other moves work. its not the parenting thats wrong

Okay, if that is the problem it’s not my fault.

Anyways…
You define the remoteevent in the client script, right? Show me where you do.

local blodlustremote = remotes.TheWorld.Bloodlust

Screen Shot 2020-07-10 at 6.27.53 PM

yezzir

Where do you define Remotes? Can you just paste the entire client script, It’d help alot.

uhm… the entire client script is really unrelated and it handles a whole entire 6 moves, with 575 lines of code. here is the parts that matter:

local rp = game.ReplicatedStorage
local remotes = rp.Remotes
local blodlustremote = remotes.TheWorld.Bloodlust
local blooddeb = false
local blodcd = 5.3
function blodfro()
	if thang.Value > 0 then
		if Character:FindFirstChild("TheWorld") then
			if canattack == true then
				blodlustremote:FireServer()
			end
		end
	end
end
UIS.InputBegan:Connect(function(input,IsTyping)
	if IsTyping then
		return
	elseif input.KeyCode == Enum.KeyCode.H then
		if Player.Character:FindFirstChild("TheWorld") then
			if not Character.Humanoid:FindFirstChild("CantAttack") then
				blodfro()
			end
		end
	end
end)
blodlustremote.OnClientEvent:Connect(function()
	print("joe mama fatst")
	local bloodcolor = game.Lighting.Bleeding
	
	bloodcolor.Enabled = true
	
	print("recieved the thing")
	wait(blodcd)
	print("waited")
	bloodcolor.Enabled = false
end)

Okay. Using your code, what other errors are in the output before you touch the part?

none.
(30 characters ruined the simplicity of this reply but no one would understand a heart on the reply)

just take a screenshot of it please