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

Can anyone troubleshoot a problem I'm having with a script I'm trying to make? (See script below)

Asked by
StarAd 50
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
wait (60)
    game:GetService("TeleportService"):Teleport(124409356, player)

The previous answer helped, but didn't answer exactly what I meant. I meant the TeleportService, where it teleports you game-to-game. The previous answer WAS very helpful though!

1 answer

Log in to vote
1
Answered by 10 years ago

Alright. I think I have a solution. Basically, all I could come up with is an onTouch script, so what I recommend doing is putting a block on your spawnpoint with this script inside it.

**Name this script "TouchScript"

wait(60)
local teleporter = script.Parent

local beam_1 = teleporter.teleBeam1
local beam_2 = teleporter.teleBeam2
local beam_3 = teleporter.teleBeam3

local spinCo 

local vCharacter
local torso
local humanoid

function spin()
    if vCharacter and torso and humanoid then       
        humanoid.WalkSpeed = 0.0
        torso.CFrame = beam_2.CFrame    + Vector3.new(0, -2, 0) 
        bg = Instance.new("BodyGyro")
        bg.Name = "Spin"
        bg.maxTorque = Vector3.new(100000, 100000, 100000)
        bg.P = 100000
        bg.Parent = torso
        bg.cframe = torso.CFrame

        fire = Instance.new("Fire")
        fire.Parent = beam_3
        fire.Color = Color3.new(0, 0, 0.6)
        fire.SecondaryColor = Color3.new(0, 0, 0)
        fire.Heat = 20
        fire.Size = 5

        bv = Instance.new("BodyVelocity")
        bv.Name = "Rise"
        bv.Parent = torso
        bv.P = 100000
        bv.maxForce = Vector3.new(0, bv.P, 0)
        local v = Vector3.new(0, 0.1, 0)
        for i = 1, 180 do 
            bg.cframe = torso.CFrame * CFrame.Angles(0, i * math.pi/10, 0)
            bv.velocity = v * i/10
            wait()
        end
        if bg then bg:Remove() end  
        if bv then bv:Remove () end
        humanoid.WalkSpeed = 16.0       
    end
end

function tele(hit) 
    print("In function")
    if not hit or not hit.Parent then return end 
    print("found hit")
    humanoid = hit.Parent:FindFirstChild("Humanoid") 
    torso = hit.Parent:FindFirstChild("Torso")
    if not humanoid then return end 
    if not torso then return end
    print("Found humanoid")
    vCharacter = hit.Parent 
    if vCharacter then 
        print("Found character")            
        tp = vCharacter:FindFirstChild("TeleportScript")
        if spinCo == nil or coroutine.status(spinCo) == 'dead' then
            spinCo = coroutine.create(spin)
            coroutine.resume(spinCo)
        end
        if tp == nil then 
            print("Cloning Script")
            tp = script.TeleportScript:Clone() 
            tp.Parent = vCharacter 
            wait(1.0) 
            tp.Disabled = false 
        else
            wait(1.0)
            tp.Disabled = true
            wait(0.1)
            tp.Disabled = false 
        end
    end 
end



beam_1.Touched:connect(tele)
beam_2.Touched:connect(tele)
beam_3.Touched:connect(tele)



Inside that create another LOCAL script with this inside **CALL THIS "TeleportScript"

local place = script:FindFirstChild("PlaceId")
local spawn = script:FindFirstChild("SpawnName")
local placeId
local spawnName 
if place then
    placeId = place.Value
    if spawn and spawn.Value then 
        spawnName = spawn.Value
        game:GetService("TeleportService"):TeleportToSpawnByName(placeId, spawnName)
    else 
        game:GetService("TeleportService"):Teleport(placeId)
    end
end


NOW, INSIDE THE LOCAL SCRIPT, add two things. ONE: an IntValue named "PlaceId" put the place ID in it Example:158668406 and TWO: a StringValue: Call this "SpawnName" and change the value to the spawn locations name if you have a chosen one. Thats it. Good luck!

ALSO> >>>MAKE SURE YOU PUT THIS INTO A MODEL CALLED 'Teleporter'

0
What do I put where it says "spawnName" in the local script? Thanks this, helps so much!! StarAd 50 — 10y
0
Which ID do I put in the IntValue? The game the teleporter is in or the one it is teleporting to?' StarAd 50 — 10y
0
"local beam_3 = teleporter.teleBeam3" This line is creating errors! AH sorry for all the questions! StarAd 50 — 10y
0
No problem! I'm no master scripter myself. And to answer your questions: nightmare13542 45 — 10y
View all comments (2 more)
0
1. Like in an obstacle course, there are spawn names, or in Base Wars; You could change the spawn name to "Lava Jumps" or "Green team" Etc. nightmare13542 45 — 10y
0
2. Second. The one it is teleporting to. **3.** I'm not sure what the error with this one is. I think you can delete that line. nightmare13542 45 — 10y
Ad

Answer this question