I have a dictionary where each part corresponds to another part, so that I can get a parts corresponding part from the part. Here’s my script:
local doorToZoneTable = {
bakery = bakeryZone,
fantasy = fantasyZone,
jungle = jungleZone,
mars = marsZone,
ocean = oceanZone,
party = partyZone,
space = spaceZone,
tech = techZone
}
fireOutOfTime.OnClientEvent:Connect(function(door)
door.CanCollide = true
local targetZone = doorToZoneTable[door]
local isWithinZone = targetZone:findLocalPlayer()
if isWithinZone then
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
hrp.Position = Vector3.new(door.CFrame.Position.X, door.CFrame.Position.Y, (door.CFrame.Position.Z + 5))
end
end)
For some reason though, when I try to get the corresponding part, it won’t work. Why is this happening?