I'm not sure why this won't work. There is a brick named "Power" located in a model. There is also 2 other bricks in the model: "TeleportBrick1" and "TeleportBrick2"
TeleportBrick2 does not have any scripts inside of it.
The script inside TeleportBrick1 is this:
1 | script.Parent.Touched:connect( function (hit) |
2 | if hit.Name = = "Power" then |
3 | hit.CFrame = script.Parent.Parent.TeleportBrick 2. CFrame |
4 | end |
5 | end ) |
The script inside Power is this:
1 | while true do |
2 | script.Parent.CFrame = script.Parent.CFrame * CFrame.new(-. 01 , 0 , 0 ) |
3 | wait(. 001 ) |
4 | end |
The script inside of Power is functioning perfectly.
The script inside of TeleportBrick1 is not functioning at all. There is no output.
The brick named "Power" happens to go directly through the center of "TeleportBrick1".
Can anyone help?
Instead or CFraming, you can always try "Position"
For instance--
while true do
while true do script.Parent.Position = script.Parent.Position * Vector3.new(-.01, 0, 0) wait(.001) end
The script may be invalid, but you get what I'm doing here.
I believe it's because you are cframing to it and not actually "hitting" it.
This will be the script for Brick A
01 | --Enter the name of the model you want to go to here. |
02 | ------------------------------------ |
03 | modelname = "teleporter1b" |
04 | ------------------------------------ |
05 |
06 | function onTouched(part) |
07 | if part.Parent ~ = nil then |
08 | local h = part.Parent:findFirstChild( "Humanoid" ) |
09 | if h~ = nil then |
10 | local teleportfrom = script.Parent.Enabled.Value |
11 | if teleportfrom~ = 0 then |
12 | if h = = humanoid then |
13 | return |
14 | end |
15 | local teleportto = script.Parent.Parent:findFirstChild(modelname) |
This is the script for Brick B
01 | --Enter the name of the model you want to go to here. |
02 | ------------------------------------ |
03 | modelname = "teleporter1a" |
04 | ------------------------------------ |
05 |
06 | function onTouched(part) |
07 | if part.Parent ~ = nil then |
08 | local h = part.Parent:findFirstChild( "Humanoid" ) |
09 | if h~ = nil then |
10 | local teleportfrom = script.Parent.Enabled.Value |
11 | if teleportfrom~ = 0 then |
12 | if h = = humanoid then |
13 | return |
14 | end |
15 | local teleportto = script.Parent.Parent:findFirstChild(modelname) |
Use this as an example and see if it works.