im trying to make it that when a player touches a brick they get teleported from where they are upwards but its not working
1 | script.Parent.Touched:connect( function (t) |
2 | if t.Parent.Humanoid ~ = nil then |
3 |
4 | t.Parent.HumanoidRootPart.CFrame = t.Parent.HumanoidRootPart.CFrame.new( 0 , 20 , 0 ) |
5 |
6 | end |
7 | end ) |
CFrame.New
does not work when trying to define the target's position. You have to make it look at the target's CFrame again, then add by 20 in the Y portion with Vector3. (assuming you want the player to go up instead of a certain position.) Fixed script is here:
1 | script.Parent.Touched:connect( function (t) |
2 | if t.Parent.Humanoid ~ = nil then |
3 |
4 | t.Parent.HumanoidRootPart.CFrame = t.Parent.HumanoidRootPart.CFrame + Vector 3. new( 0 , 20 , 0 ) --it looks at the target, and defines the position by adding 20 to the vector3 y position. |
5 |
6 | end |
7 | end ) |
Hope you got it, and if it worked accept my answer.