So I have a PassLevel function, which is supposed to, you know, pass the level for the player.
Here's the module function
function module:PassLevelServer(pastLevel, nextLevel, player)
local character = player.Character
local hrp = character.HumanoidRootPart
local LoadingScreenModel = workspace.World.LoadingScreen
local sustainer = LoadingScreenModel.Sustainer --sus
hrp.CFrame = sustainer.CFrame + Vector3.new(0,10,0)
hrp.Anchored = true
wait(1)
pastLevel:Destroy()
workspace.World.Placeable:Destroy()
wait(1)
nextLevel.Parent = workspace.World
nextLevel.Placeable.Parent = workspace.World
wait(8.1)
hrp.Anchored = false
hrp.CFrame = nextLevel.Spawn.CFrame
end
No errors in here.
Here's the server script that exists in every single PassLevel part at the end of a level.
ok = true
r = require(game.ReplicatedStorage.ForUseModules.GameFunctions)
local name = script.Parent.Parent.Name
script.Parent.Touched:Connect(function(e)
if ok then
ok = not ok
local number = tonumber(name:match("%d+"))
local plr = game.Players:GetPlayerFromCharacter(e.Parent)
game.ReplicatedStorage.PassLevel:FireClient(plr, script.Parent.Parent.Name)
r:PassLevelServer(workspace[name],game.ServerStorage.Levels["Level"..number+1], plr) -- line erroring
script.Parent:Destroy()
end
end)
It is erroring:

Making a game engine is hard. Does anyone has any idea how to solve the issue?