local Player = game.Players.LocalPlayer
local EnterSwanEvent = game.ReplicatedStorage.Events:WaitForChild("EnterSwanEvent")
local TeleportGui = Player.PlayerGui:WaitForChild("TeleportGui")
local TweenService = game:GetService("TweenService")
local MainMap = game.Workspace:WaitForChild("MainMap")
local MapToReplace = game.ServerStorage:FindFirstChild("SwanLocationMap")
EnterSwanEvent.OnClientEvent:Connect(function()
TweenService:Create(TeleportGui.Fade, TweenInfo.new(0.5), {BackgroundTransparency = 0}):Play()
task.wait(0.9)
MainMap.Parent = game.ServerStorage
MapToReplace.Parent = game.Workspace
for i, v in pairs(Player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.CFrame = MapToReplace.SwanToTeleport.CFrame
end
end
TweenService:Create(TeleportGui.Fade, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play()
end)
That’s because LocalScripts do not have access to ServerStorage, only normal Scripts have access to ServerStorage when they’re put on the server. Try putting it in ReplicatedStorage instead and see if it works then.
If it’s running on the client side, then it wouldn’t have access to anything in ServerStorage to my knowledge. I know ReplicatedStorage replicates between both client and server, so both would have access to it.