I'm tryna make it so if you have over a brick with a name it kills the player but the script doesn't do anything.
-- Local script
local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local rs = game:GetService("ReplicatedStorage")
local char = player.Character
local event = rs:WaitForChild("Killplayer")
if mouse.Target.Name == "Ivan" then
event:FireServer(player,char)
end
while wait() do
print(mouse.Target)
end
-- Server script
local players = game:GetService("Players")
local rs = game:GetService("ReplicatedStorage")
local event = rs:WaitForChild("Killplayer")
event.OnServerEvent:connect(function(player,char)
print(char:GetChildren())
local human = char:FindFirstChild("Humanoid")
if human then
human:TakeDamage(5)
end
end)

1 comment
You only check the mouse target once