ALL OF them work in F6 or solo mode but not in game mode. i know cuz scripts load faster than player, but how u fix it ?
I get this error: attempt to index field 'LocalPlayer' (a nil value) and i have no IDEA how to fix this
This script is confusing me alot, also this isn't a localscript it doesn't even work in a localscritp cuz its in a brick.
function teleportPlayer(pos, torso)
local char = torso
char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y, pos.z))
end
lvl = script.Parent.Parent.Parent.LevelValue
Door = script.Parent
script.Parent.Touched:connect(function(part)
print("Door Hit")
local human = part.Parent:FindFirstChild("Humanoid")
if (human ~= nil) then
print("Human touched door")
local player = game.Players:GetPlayerFromCharacter(human.Parent)
if (player == nil) then return end
local stats = player:FindFirstChild("leaderstats")
local sp = stats:FindFirstChild("test")
if sp == nil then return false end
print("Human passed test")
else
print("nope.avi")
GUI = Instance.new("ScreenGui")-- problem here <<<<<
GUI.Name = "ScreenGuiLVL"
GUI.Parent = game.Players.LocalPlayer.PlayerGui
Also, why does even the error happen about player nil if this is in a brick ? it should get the player by touching ?
this script works everywhere else but not in-game.

2 comments
I am pretty sure nathan answered your question.
The reason it works in Solo mode, is because there is only one player in solo mode, so LocalPlayer becomes the player and is accessible by every script in the game. In a real server, you can't use LocalPlayer because there are multiple players.