So right now im making a tool that when clicked a server script will make a part where clicked and if it detects a players humanoid then it will fire a remote event with fireclient to a localscript. What I want to happen is that the localscript will only fire for the detected player. Is that possible?

Localscript:

local Tool = script.Parent
local playere = game.Players.LocalPlayer
local mouse = playere:GetMouse()

Tool:WaitForChild("client").OnClientEvent:Connect(function()
	
	local lighting = game:GetService("Lighting")
	local col = lighting:WaitForChild("ColorCorrection")
	
	local cross = game.Workspace:WaitForChild("Cross")
	cross.Color = Color3.new(29, 29, 29)
	
	col.Enabled = true
	
	wait(7.5)
	col.Enabled = false
	
end)

Server script detect part:

Detect.Touched:Connect(function(hit)
		print("detect touched")
		if hit.Parent == player.Character then return end
		if hit and hit.Parent:FindFirstChild("Humanoid") then 
			local EnemyHum = hit.Parent:FindFirstChild("Humanoid")
			print("tsu hit")
			
			local playa = game.Players:GetPlayerFromCharacter(hit.Parent)
			
			if playa then
				Tool.client:FireClient(playa)
				print("fired client")
				
			else
				print("playa no exist or no fire client")
			end	

2 comments

0

let me see your server script

0

Added it in