Hello, I’m trying to place automatically respawn parts under my obby stages to make players respawn faster when they fall. I need to scale it and place it 10 studs under the lowest part of the stage. I have two issues with this: first is that it places it under the primary part of the stage. Second is that the first one is perfectly scaled, but the second one is twice as long, the 3rd one is 3 times bigger and so on. Here’s is the function in the module script:
function module.ScalePart(Stage: Model)
local NewPart = RespawnPart:Clone()
NewPart.Parent = Stage
local Size = Stage:GetBoundingBox()
local NewX = Size.X * 2
local NewY = 5
local NewZ = Size.Z
local NewSize = Vector3.new(NewX, NewY, NewZ)
NewPart.Size = NewSize
local CF = Stage:GetPivot()
-- this prints 0
print( tostring( (CF.Position - Stage.Start.Position) .Magnitude ) )
local LowestPart = Stage.Base
for i, v in pairs(Stage:GetChildren()) do
if v:IsA("BasePart") then
if v.Position.Y < LowestPart.Position.Y then
LowestPart = v
end
end
end
NewPart.CFrame = CF - Vector3.new(0, LowestPart.Position.Y + 10, 0)
-- just to see the parts:
NewPart.Transparency = 0
NewPart.BrickColor = BrickColor.Random()
end
Additional info:
- The obby is different for everyone and is client sided.
- The script inside the respawn is not running for some reason (it isn’t a local script).
- The primary part is called Start and is placed at the beginning of the stage
Thank you for helping me!