Title is self explanatory when streamingenabled is true then on client the part is nil but if its false then it gets recognized on client
Server Script: Create part and send it to local
function Teleport(Plr, Target)
local Char = Plr.Character
local humanoidRoot = Char.HumanoidRootPart
local humanoid = Char.Humanoid
local ray = RaycastParams.new()
ray.FilterDescendantsInstances = {workspace.HexMapBin}
ray.FilterType = Enum.RaycastFilterType.Include
local floorRay = workspace:Raycast((humanoidRoot.CFrame * CFrame.new(Vector3.new(0, 0, 0))).Position, Vector3.new(0, -100, 0), ray)
if floorRay then
local walkspeed = humanoid.WalkSpeed
humanoidRoot.Anchored = true
humanoid.WalkSpeed = 0
local Portal = Rep.HexPaths.Portal:Clone()
print(floorRay.Instance, floorRay.Instance.Size.Y / 2, Portal.Size.Y / 2)
Portal.Position = floorRay.Instance.Position + Vector3.new(0, floorRay.Instance.Size.Y / 2 + Portal.Size.Y / 2, 0)
Portal.Parent = workspace.TrashBin
wait()
local CamPart = Instance.new("Part", workspace)
CamPart.Transparency = 1
CamPart.CanCollide = false
CamPart.Anchored = true
print(CamPart)
CameraEvent:FireClient(Plr, "Subject", CamPart)
task.wait(.5)
local Tweeny = TweenService:Create(humanoidRoot, TweenInfo.new(1, Enum.EasingStyle.Quint), {CFrame = floorRay.Instance.CFrame * CFrame.new(Vector3.new(0, -8, 0))})
Tweeny:Play()
local portal = Rep.HexPaths.Portal:Clone()
portal.Position = Target.Position + Vector3.new(0, Target.Size.Y / 2 + portal.Size.Y / 2, 0)
portal.Parent = workspace.TrashBin
task.delay(1.01, function()
humanoidRoot.CFrame = portal.CFrame * CFrame.new(Vector3.new(0, -10, 0))
TweenService:Create(humanoidRoot, TweenInfo.new(1, Enum.EasingStyle.Quint), {CFrame = humanoidRoot.CFrame * CFrame.new(Vector3.new(0, 16, 0))}):Play()
task.wait(1)
ToggleAll(Portal, false)
ToggleAll(Portal.Attachment, false)
ToggleAll(portal, false)
ToggleAll(portal.Attachment, false)
humanoidRoot.Anchored = false
humanoid.WalkSpeed = walkspeed
--Debris:AddItem(Portal, 3.1)
--Debris:AddItem(portal, 3.1)
--CameraEvent:FireClient(Plr, "Subject", humanoidRoot)
end)
end
end
Local Script: set the camera subject to it and tween
CameraEvent.OnClientEvent:Connect(function(Event, Type)
if Event == "Shake" then
camShake:Shake(cs.Presets[Type])
elseif Event == "Subject" then
print("go")
local camera = workspace.CurrentCamera
local TweenService = game:GetService("TweenService")
local originalCameraType = camera.CameraType
local originalCameraSubject = camera.CameraSubject
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = Type
camera.CameraType = originalCameraType
print(Type)
wait(2)
local tween = TweenService:Create(Type, TweenInfo.new(2, Enum.EasingStyle.Quint), {CFrame = HRP.CFrame + Vector3.new(0,8,0)})
tween:Play()
-- Wait for the tween to complete before resetting the camera
tween.Completed:Wait()
-- Reset camera to follow the original subject and camera type
camera.CameraType = originalCameraType
camera.CameraSubject = originalCameraSubject
print("stop")
end
end)
I fixed it by just creating the part on local but i just want to know the reason of it not detecting it on local when its passed through by remote