Here is the script I made.. I don't know why it doesn't work:
Brick = script.Parent AnotherBrick = game.Workspace.TP if game.Workspace.Screen.Brickcolor.Name == "Bright green" then Brick.Touched:connect(function(part) if part.Parent.Humanoid then -- * if part.Parent.Humanoid.Health > 0 then part.Parent:MoveTo(AnotherBrick.Position) end end end)
There is a end missing and it's BrickColor, with capital c. So it would be like this:
Brick = script.Parent AnotherBrick = game.Workspace.TP if game.Workspace.Screen.BrickColor.Name == "Bright green" then Brick.Touched:connect(function(part) if part.Parent.Humanoid then if part.Parent.Humanoid.Health > 0 then part.Parent:MoveTo(AnotherBrick.Position) end end end) end
A hint: use http://wiki.roblox.com/index.php?title=Output, it's really useful to find out what is wrong in your code. Run the script and check output to see if nothing is wrong.
Edit:
Ok, I tried it in studio and worked perfectly. Just changed a line here to make more sense:
Brick = script.Parent AnotherBrick = game.Workspace.TP Brick.Touched:connect(function(part) if game.Workspace.Screen.BrickColor.Name == "Bright green" then -- more useful inside the function if part.Parent:FindFirstChild("Humanoid") then -- this will look after humanoid, if the part isn't a character part, it won't break the script if part.Parent.Humanoid.Health > 0 then part.Parent:MoveTo(AnotherBrick.Position) end end end end)