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

How to prevent my placement system flying into my face?

Asked by 5 years ago

Working on a pretty simple prototype building system and there's a few issues with it, solely the placement script (local script) that uses body positions, any help/links because I'm stuck dead in my tracks right now ps I'm unsure on how to make it so the building will go over terrain/bricks

BuildingEvents = game.ReplicatedStorage.BuildingStuff.BuildingEvents
local player = game.Players.LocalPlayer
repeat wait() until player
local mouse = player:GetMouse()



BuildingEvents.ReadyPartEvent.OnClientEvent:Connect(function(newclassname)

local model = game.ReplicatedStorage.BuildingStuff.BuildingInstances:FindFirstChild(newclassname)

local building = model:Clone()

building.Parent = game.Workspace

mouse.Move:Connect(function()

local posX = math.floor(mouse.Hit.X)

local posY = building.Union.Position.Y --unsure what to do here

local posZ = math.floor(mouse.Hit.Z)

building.Union.BodyPosition.Position = Vector3.new(posX,posY,posZ) -- it just flies in my face  

wait()

Answer this question