First of all, edit your answer so that your code is in a Code Block, that will make it a lot easier to read.
Secondly, there are several things wrong with your code.
The first problem is that you end the onTouch function before you actually do anything in it.
Another problem would be that you have (kill) in the parentheses next to onTouch, when it should be (player) as that targets the player.
You state the Hierarchy game.workspace.murder but do nothing with it, so nothing would happen. You would have to give it something to do, or do something to it.
I'm going to basically write you a new code, and explain why it works over yours in comments.
local Player = game.Players.LocalPlayer
function onTouch()
Player.Character:WaitForChild("Humanoid").Health = 0
end
script.Parent.Touched:connect(onTouched)
As long as you put the script inside the murder brick, the script should function fine.
A few pointers:
-Make sure your spelling and capitalization is correct, as this is key for scripts to function properly.
-Make sure you don't end functions before the events you want to happen in the function occur.
I would suggest the Wiki for beginners to learn the basics of scripting.
I hope this helped!
1 comment
it is supposed to look neater