KossmoZ
(KossmoZ)
October 25, 2019, 8:00pm
#1
I’m working on a chunk system that loads different portions of the Map, included in this is the insertion of house interiors etc.
The Player enters the exterior etc. Then (Teleports) to the interior.
I was wondering the best method for rendering these?
My personal idea is to have a value set in the initial Entrance with the ID for the corresponding room; then it’s inserted.
Located within the interior is the ‘Exit’ and inserted in that, is the Position for the Player to return to upon touching it. After doing so, it is removed.
Any other method of doing this?
Below is a poor diagram of my explanation.
1 Like
KossmoZ
(KossmoZ)
October 25, 2019, 10:06pm
#2
So far, this is what I have in controlling the doors and such prior to loading the chunks. Thoughts?
local Camera = workspace:WaitForChild("Camera")
local Player = game:GetService("Players").LocalPlayer
repeat wait(.05) until Player.Character
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local Debounce = false
--||--||--||--
Humanoid.Touched:Connect(function(Obj)
if Debounce == false then else return end
if Obj.Name == "Trigger" and Obj.Parent.Name == "#Door" then
Debounce = true
DoorFunction(Obj.Parent)
else return end
end)
--||--||--||--
function Tween(Obj, Time, Style, Properties)
game.TweenService:Create(Obj, TweenInfo.new(Time, Style), Properties):Play()
end
--||--||--||--
function DoorFunction(Door)
if Door["DoorType"].Value == "Single" then
spawn(function()
Tween(Door:WaitForChild("Hinge"), .5, Enum.EasingStyle.Linear, {CFrame = Door["Hinge"].CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)})
wait(1.5)
Tween(Door:WaitForChild("Hinge"), .5, Enum.EasingStyle.Linear, {CFrame = Door["Hinge"].CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)})
end)
elseif Door["DoorType"].Value == "Double" then
spawn(function()
end)
elseif Door["DoorType"].Value == "Slide" then
spawn(function()
Tween(Door["Door"]:WaitForChild("LeftDoor"), .5, Enum.EasingStyle.Linear, {CFrame = Door["Door"].LeftDoor.CFrame + Door["Door"].LeftDoor.CFrame.LookVector * 5})
Tween(Door["Door"]:WaitForChild("RightDoor"), .5, Enum.EasingStyle.Linear, {CFrame = Door["Door"].RightDoor.CFrame + Door["Door"].RightDoor.CFrame.LookVector * 5})
wait(1.5)
Tween(Door["Door"]:WaitForChild("LeftDoor"), .5, Enum.EasingStyle.Linear, {CFrame = Door["Door"].LeftDoor.CFrame - Door["Door"].LeftDoor.CFrame.LookVector * 5})
Tween(Door["Door"]:WaitForChild("RightDoor"), .5, Enum.EasingStyle.Linear, {CFrame = Door["Door"].RightDoor.CFrame - Door["Door"].RightDoor.CFrame.LookVector * 5})
end)
elseif Door["DoorType"].Value == "N/A" then
spawn(function()
end)
return
else return end
if Door:FindFirstChild("CameraPosition") ~= nil then
Camera.CameraType = Enum.CameraType.Scriptable
Tween(Camera, .5, Enum.EasingStyle.Linear, {CFrame = CFrame.new(Door.CameraPosition.CFrame.p + Door.CameraPosition.CFrame.LookVector * 15 + Vector3.new(0, 15, 0), Door.Trigger.CFrame.p)})
else end
Controls:Disable()
wait(.5)
Humanoid:MoveTo(Door.Trigger.CFrame.p - Door.Trigger.CFrame.LookVector * 10)
end
--||--||--||--