#Critique my script

1 messages · Page 1 of 1 (latest)

potent panther
#
local pair = workspace.challengePads.pair1
local one = pair.l1
local two = pair.r1

local spawn1 = workspace.spawn1
local spawn2 = workspace.spawn2

local wall1 = workspace.wall1
local wall2 = workspace.wall2

local status1 = false
local status2 = false

local function tpFromPads(p1, p2, spawn1, spawn2)
    p1.Position = spawn1.Position
    p2.Position = spawn2.Position + Vector3.new(0,3,0)
    p1.Orientation = Vector3.new(0,-90,0)
    p2.Orientation = Vector3.new(0,90,0)
end


local function onTouch(part, pad, wall)
    local root = part.Parent:FindFirstChild("HumanoidRootPart")
    if root then
        pad.CanTouch = false
        wall.CanCollide = true
        pad.Color = Color3.new(0, 0.666667, 1)
        root.Position = pad.Position + Vector3.new(0,3,0)
        root.Orientation = Vector3.new(0,90,0)
        
        if pad == one then
            status1 = root
        elseif pad == two then
            status2 = root
        end
        
        print(part.Name..status1.Name..status2.Name)
        if status1 and status2 then
            tpFromPads(status1, status2, spawn1, spawn2)
        end

    end
end
#

bump

#

bump

#

bump

odd yew
potent panther
#

im ultra noob

odd yew
#

Couldve used tables and instead of setting p1s and p2s position manually you may have used :PivotTo() on their character

potent panther
#

i have to do this same script for 7 pairs

odd yew
#

basically everything u need is there

potent panther
#

for reference im just trying to create a pair of pads where if both pads are each occupied by a player, then the 2 players get tped into the match, and the match begins

and after the match begins, the movement system changes because the players would be equipped with certain things

after the match ends players go back to default roblox movement system

potent panther
#

idk i progress rlly slow doing that

odd yew
#

Just oractice

#

Write and learn

#

If you dont know how, gi there

potent panther
#

ok but thx for the motivation twin

amber orchid
# potent panther ```lua local pair = workspace.challengePads.pair1 local one = pair.l1 local two ...

its okay but i would use CFrame instead of Position for most things and i would use tables for your locals since they seem to not have extremely important variable names. I would also use folders in the workspace to organize better. what i would do for your locals: ```lua
local pairTable = workspace.challengePads.pair1:GetChildren();

local spawns = {workspace.spawn1, workspace.spawn2}; -- or spawns:GetChildren() with folders

local walls = {workspace.wall1, workspace.wall2}; -- or walls:GetChildren() with folders

local states = {false, false};```

#

tables are more optimized but can be less organized so you dont want to use them for some things (maybe the states thing) if you need to remember the things consistently, but since the variable naming was already iffy i just put it into a table.

potent panther
#

would implementing these increase performance on the players side?

#

@amber orchid

amber orchid
#

it would jiust make it easier to implement more things to the game