Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My teleport pads are not working no matter what i do. Why?

Asked by 7 years ago
Edited 7 years ago

So i began by searching up scripting commands so i could attempt to do it myself (im pretty new at scripting). As i expected, i didnt really work at all :P However, i really wasnt too far off(i dont actually remember what i did since it was a bit ago and iv been trying to figure out exactly what was wrong with other attempts i tried even with a guide. (After probably a total of 3 frustrating hours of trying to do this simple task of moving a player, i eventually came here)

My most recent event involved looking up a video online of someone doing a teleport pad tutorial....which means it was tested and worked.... But it still didnt work.... I literally did EXACTLY what was in the video. I even created a brand new place just in case there was some bug or virus in my other places. Nope. Still didnt work.

here are the scripts i had, where my GREEN pad teleported right next to my RED pad:

GREEN PAD

script.Parent.Touched:connect(function(hit))
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.Torso.CFrame = CFrame.new(-173, 0.5, -43)


    end)
end)

RED PAD

script.Parent.Touched:connect(function(hit))
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.Torso.CFrame = CFrame.new(-143, 0.5, 90)


    end)
end)

PLEASE help me.... It is driving me crazy that i cant do this....

EDIT:

This is the script i actually have. Idk what happened, but the script above got a little messed up when i was copying/pasting them

script.Parent.touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.Torso.CFrame = workspace.RedPad.CFrame
    end

end)

0
How old are the video? MineJulRBX 52 — 7y

3 answers

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
7 years ago
Edited 7 years ago

You have some extra parentheses in your script on line 1 and 6.

Green Pad

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid')~=nil then
    if hit.Parent:FindFirstChild("UpperTorso")~=nil then
            hit.Parent.UpperTorso.CFrame = CFrame.new(-173, 0.5, -43)
    elseif hit.Parent:FindFirstChild("Torso")~=nil then
        hit.Parent.Torso.CFrame = CFrame.new(-173, 0.5, -43)
    end
    end
end)

Red Pad

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid')~=nil then
        if hit.Parent:FindFirstChild("UpperTorso")~=nil then
            hit.Parent.UpperTorso.CFrame = CFrame.new(-143, 0.5, 90)
    elseif hit.Parent:FindFirstChild("Torso")~=nil then
        hit.Parent.Torso.CFrame = CFrame.new(-143, 0.5, 90)
    end
    end
end)

If you want to teleport the player to the other pad just off to the side we can do this Green Pad

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid')~=nil then
    if hit.Parent:FindFirstChild("UpperTorso")~=nil then
            hit.Parent.UpperTorso.CFrame = workspace.RedPad.CFrame + Vector3.new(3,0,0)
    elseif hit.Parent:FindFirstChild("Torso")~=nil then
        hit.Parent.Torso.CFrame = workspace.RedPad.CFrame + Vector3.new(3,0,0)
    end
    end
end)

Red Pad

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid')~=nil then
    if hit.Parent:FindFirstChild("UpperTorso")~=nil then
            hit.Parent.UpperTorso.CFrame = workspace.GreenPad.CFrame + Vector3.new(3,0,0)
    elseif hit.Parent:FindFirstChild("Torso")~=nil then
        hit.Parent.Torso.CFrame = workspace.GreenPad.CFrame + Vector3.new(3,0,0)
    end
    end
end)
0
Oops, idk what heppened, but those extra parentheses arnt in my script, so i guess there must have just been something weird when i was copy/pasting the stuff. Pilot13579 0 — 7y
0
Also.....i tried doing exactly that....both of your suggestions actually....neither worked....now, im not saying your scripts are wrong, cause they look very right to me, but it seems my game is kinda effed up apparently... Pilot13579 0 — 7y
0
@Pilot13579 maybe sending a pic of the hierarchy would help? Or a pic of what you have in your script to see if there's something with the text. DanzLua 2879 — 7y
View all comments (3 more)
0
@Pilot13579 Any errors? Are you using R6 or R15? DanzLua 2879 — 7y
0
My game has R15 set. Pilot13579 0 — 7y
0
@Pilot13579 I updated the code to work with both r6 and r15. DanzLua 2879 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Try this script

local Debounce = false
script.Parent.Touched:connect(function(Obj)
    if Debounce == false then
        Debounce = true
        if Obj:FindFirstChild("Humanoid") ~= nil then
            Obj.Parent.Torso.CFrame = game.Workspace.RedPad.CFrame + Vector3.new(3,0,0)
        end
        wait(2)
        Debounce = false
    end
end)
0
....Well....um...idk, but this didnt work either... :/ Pilot13579 0 — 7y
0
thx for trying to help tho... :( Pilot13579 0 — 7y
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Since R15 has been released, don't use Torso or UpperTorso, neither one is present and will work for both. The best practise is to use HumanoidRootPart, this way it'll work for both flawlessly. Try this:

Green Pad

script.Parent.touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.HumanoidRootPart.CFrame = workspace.RedPad.CFrame+Vector3.new(0,2.5,0)
    end
end)

Red Pad

script.Parent.touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.HumanoidRootPart.CFrame = workspace.GreenPad.CFrame+Vector3.new(0,2.5,0)
    end
end)

If this has solved your problem, accept it as the answer. If it hasn't, comment below with any errors that occur.

0
Nope...didnt work....however....Stuff ACTUALLY did REACT to this script, even if it wasnt supposed to do that :P Here is a screenshot: https://drive.google.com/file/d/0B4lQbI5NALgxMDJsczV5ZlF3TGM/view?usp=sharing Pilot13579 0 — 7y
0
I did something stupid, try the scripts now, I updated the post. General_Scripter 425 — 7y

Answer this question