Make something spawn right above a part

I’m trying to make something that automatically scales and positions itself, how do I go about making some spawn 0.1 studs above a part?

local SpawnPoint = game.Workspace.Part
local Part = game.Workspace.AEAEAEeaeAE

Part.Position.Y = (SpawnPoint.Size.Y + SpawnPoint.Position.Y) + (Part.Size.Y * 2) -- change * 2 to the offset
2 Likes

“Y cannot be assigned to” is the error I’m getting.

local SpawnPoint = game.Workspace.Part
local Part = game.Workspace.AEAEAEeaeAE

Part.Position = Vector3.new(Part.Position.X, (SpawnPoint.Size.Y + SpawnPoint.Position.Y) + (Part.Size.Y * 2) -- change * 2 to the offset, Part.Position.Z)

My bAd, It works now

This is the code so the part you want gets put ON the other part, instead of its own position with only the Y axis changing (credits to Ping for the formula I forgot)

local SpawnPoint = game.Workspace.Part1
local Part = game.Workspace.Part2

Part.Position = Vector3.new(SpawnPoint.Position.X, (SpawnPoint.Size.Y + SpawnPoint.Position.Y) + (Part.Size.Y * 0), SpawnPoint.Position.Z)

Before running the code i wrote:


After:

Screenshot (314)
The green box is not positioned correctly, idk if It’s on my part or yours.
Here’s what I did:

MapKit.MapStart.Position = Vector3.new(StartScale.Position.X, (StartScale.Size.Y + StartScale.Position.Y) + (StartScale.Size.Y * 0.5))

Testing it right now, I’ll let you know how it goes.

Not exactly what I’m looking for, it only works when size doesn’t vary.

Solved it!

Part.Position = SpawnPoint.Position + Vector3.new(0, (SpawnPoint.Size.Y / 2) +(Part.Size.Y / 2), 0)