(Sorry in advance if formatting is weird, I tried)
So, I managed to solve this issue without Region3 in a sort of interesting way that I thought would be worth noting on here. I used two local scripts, both of which are posted down below.
Essentially what I did was create a part named "REGION" that follows the player around to a new area every time they scoot themselves horizontally by 3 or -3 (since it's a 6x6x6 area). It follows horizontally in the Z direction as well as vertically in the Y direction. For visual purposes right now, the part is still visible, however, in the final game, it would be invisible to the player.
The second script is within a tool whose purpose is to place ladders when it clicks a block named "REGION". This ladder is placed towards the very back of the block in a spot where the user can access it easily (this is a platform style game, by the way, so rotation isn't taken into account here).
Here is the first script (the new script block thing really sucks, this took forever to paste in)
local player1 = script.Parent.Parent
local player = workspace:WaitForChild(player1.Name)
local part = Instance.new("Part",workspace)
part.Anchored = true
part.Name = "REGION"
part.CanCollide = false
part.Transparency = .5
part.BrickColor = BrickColor.new("Really red")
part.Size = Vector3.new(6,6,6)
part.CFrame = CFrame.new(-3,51,-3)
game:GetService("RunService").RenderStepped:Connect(function()
local pos = player:FindFirstChild("Head").CFrame
if pos.Z-part.Position.Z >= 3 then
part.CFrame = CFrame.new(part.Position.X,part.Position.Y,part.Position.Z + 6)
else if pos.Z - part.Position.Z <= -3 then
part.CFrame = CFrame.new(part.Position.X,part.Position.Y,part.Position.Z - 6)
end
end
if pos.y - part.Position.Y >= 4 then
part.CFrame = CFrame.new(part.Position.X,part.Position.Y+6,part.Position.Z)
else if pos.Y - part.Position.y <= -3 then
part.CFrame = CFrame.new(part.Position.X,part.Position.Y-6,part.Position.Z)
end
end
end)
And here is the second script:
local ladder = game.workspace.LadderModel
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent
tool.Activated:Connect(function()
if (workspace.Part.Position - script.Parent.Handle.Position).Magnitude < 10 then
local part = workspace.Part
end
if mouse.Target ~= nil and mouse.Target.Name == "REGION" then
local clone = ladder:Clone()
clone.Parent = workspace
clone:SetPrimaryPartCFrame(CFrame.new(mouse.Target.Position.X - 2,mouse.Target.Position.Y,mouse.Target.Position.Z))
end
end)
Hope this is helpful to anyone trying to do something similar!
2 comments
im pretty sure you have to use region3 or seomthing not sure
I thought that was just for terrain? Would it work with parts?