I used to know this, but its been a long time since ive programmed, so is it like
1 | function onTouch() |
2 | game.Worksapce.Parent:Destroy() |
I really wanna know
Good try attempting to script it yourself. Indeed, both lines are correct, but you forgot quite a lot.
1 | script.Parent.Touched:connect( function (player) --So, the brick is touched and the person touching it is now called "player" |
2 | Humanoid = player.Parent:FindFirstChild( "Humanoid" ) --Searches for a humanoid |
3 | if Humanoid ~ = nil then --If the humanoid is present (Basically checks for a player) then... |
4 | script.Parent:Destroy() --Completely removes the object from the game |
5 | end --Ends the if statement |
6 | end --Ends the function |
7 | --Put this in the object that gets destroyed. Otherwise, this may not work properly |
I don't know if this is what you are wanting, but this may work for you.
1 | -- You must put this in a part |
2 | function onTouched(hit) |
3 | if hit.Name = = "Part" then --Change this to what ever the part is called fyi :P |
4 | hit:remove() |
5 | end |
6 | end |
7 |
8 | script.Parent.Touched:connect(onTouched) |
You have to put this script in a part.
Example When you step on the part i will call "P1" It will destroy a different part i will call "P2" So, the the script should be in "P1" The script should look like:
1 | -- You must put this in a part |
2 | function onTouched(hit) |
3 | if hit.Name = = "P2" then --Change this to what ever the part is called fyi :P |
4 | hit:remove() |
5 | end |
6 | end |
7 |
8 | script.Parent.Touched:connect(onTouched) |