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

script to teleport players touching a brick to a random map??

Asked by 4 years ago
Edited 4 years ago

I have been trying this out for a hour, I'm quite new to scripting and I have been using this site for a while, looking at posts for reference, tho I never made a account till now. I don't have anything of use of a script I was using but I would really appreciate it if one you could help me out with this!

Thanks!

KitAffects.

value = math.random(1,3) if number(1)then function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if p ~= nil then p.Torso.CFrame = CFrame.new(insert map location here) end end script.Parent.Touched:connect(onTouched) end

if number(2)then function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if p ~= nil then p.Torso.CFrame = CFrame.new(insert map location here) end end script.Parent.Touched:connect(onTouched) end if number(2)then function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if p ~= nil then p.Torso.CFrame = CFrame.new(insert map location here) end end script.Parent.Touched:connect(onTouched) end

0
Give us some of the attempts. This isnt a request site. Oh well its not like I care about it anyways. Ill try to make the script. Also what do you mean about a random map voidofdeathfire 148 — 4y
0
kk KitAffects 2 — 4y
0
thanks a lot. I edited the question to include something i pieced together. KitAffects 2 — 4y
0
by random map I mean the location of the map the players will be fighting in, KitAffects 2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Heres a basic version. It will teleport you very fast but does the job,

local map = {}--insert map location like game.workspace.map.MAP_NAME
-- Example: local map = {game.Workspace.Map,game.Workspace.Map2,game.Workspace.Part}
script.Parent.Touched:Connect(function(hit)
   for i,v in pairs(game.Players:GetChildren())do
    if hit.Parent ~= nil then
        if hit.Parent.Name == v.Name then
            local HumanoidRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")
            if HumanoidRootPart ~= nil then
                HumanoidRootPart.CFrame = map[math.random(1,#map)].CFrame
            end
            end
        end
    end
end)
0
If this helps please accept the answer voidofdeathfire 148 — 4y
0
Also comment here if you have any problems voidofdeathfire 148 — 4y
Ad

Answer this question