(sorry if the title is misleading, I couldn't convert it to a question. The original name was "FindFirstChild question")
So I am making a script where I want a person to touch a brick and it falls down on them (already made) and when the brick touches the ground, it will kill the person.
The output shows nothing because I can't see it during a real game and in studio my player is named "Player"
So I did:
wait(1)
death1 = game.Workspace.Box
function onTouch(hit)
death1.CanCollide = false
game.Workspace:FindFirstChild("Box")
if "Box" ~= nil then
death1.CFrame = CFrame.new(120, 18, -475)
wait(0.2)
death1.CFrame = CFrame.new(120, 11, -475)
wait(0.2)
local b = game.Workspace.Player:FindFirstChild("Humanoid")
if b ~= nil then
b.Health = 0
end
wait(3)
death1.CanCollide = true
if b.Health == 0 then
death1.CFrame = CFrame.new(120, 18, -475)
death1.CanCollide = false
script.Parent:connect(onTouch)
now this all works fine.
BUT
When I get out of studio and test it, it just falls down and do nothing. I know why it doesn't, because in workspace it doesn't find "Player" because my username isn't player.
So my question is, how would I find a player and kill them if their name isn't "player'?
This would be really nice if I could get it to work.

3 comments
This wouldn't work well since you're handling this locally.
I didn't want to go into detail with the on touched event, I said to find a work around, because there are plenty.
Not that, the script you had before was in a local script and using the parent of the script to call the touch event which is incorrect.