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
#Critique my script
1 messages · Page 1 of 1 (latest)
Very basic. For a very early beginner It's okay.
im ultra noob
Couldve used tables and instead of setting p1s and p2s position manually you may have used :PivotTo() on their character
pls teach
i have to do this same script for 7 pairs
Nah just use youtube, roblox documentary and roblox developer forum
basically everything u need is there
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
i did but
idk i progress rlly slow doing that
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.
thank you so much
would implementing these increase performance on the players side?
@amber orchid
slightly, but not really noticable
it would jiust make it easier to implement more things to the game