Hello all who are reading this right now. I have a wall placement system making use of points and a wall fill part.
Here is a basic rewrite of the system:
local Plot = workspace.Plot
local Point1 = Instance.new("Part", workspace)
Point1.Size = Vector3.new(.5, 10, .5)
Point1.Anchored = true
-- THIS SEEMS TO BE WHERE THE ISSUE TAKES PLACE??
local PlacePoint1 = RunService.RenderStepped:Connect(function()
System(Point1, Plot, Params) -- Raycast params are defined but I left it out
end)
UserInputService.InputBegan:Connect(function(Input, GP)
if Input.UserInputType == Enum.UserInputType.MouseButton1 and not GP then
PlacePoint1:Disconnect() -- Stop the placement of the first point
local Point2 = Instance.new("Part", workspace)
Point2.Size = Vector3.new(.5, 10, .5)
Point2.Anchored = true
local WallPart = Instance.new("Part", workspace)
WallPart.Anchored = true
local PlacePoint2 = RunService.RenderStepped:Connect(function()
System(Point2, Plot, Params) -- Raycast params are defined but I left it out
local PosA = Point1.Position
local PosB = Point2.Position
local Distance = (PosA - PosB).Magnitude
WallPart.Size = Vector3.new(.5, 10, Distance)
WallPart.CFrame = CFrame.new(PosA, PosB) * CFrame.new(0,0,-Distance*.5)
end)
UserInputService.InputEnded:Connect(function(Input, GP)
if Input.UserInputType == Enum.UserInputType.MouseButton1 and not GP then
PlacePoint2:Disconnect()
end
end)
end
end)
The problem I have is that when I call this (It’s part of a function in a ModuleScript
) it will use the original Point1 instead of the new point.
If you need any other information from me just ask for it. Thanks for your help!