I have tried many ways like using local script but still doesn't work so I try to use normal script again. For the local script the LocalPlayer works but my other script doesn't work, it stops. Maybe it's because I put all of the script together. I'm confused about the local script and LocalPlayer. The script is for minigame that I am making. So here's my script :
--start
game.Players.ChildAdded:wait()
--variables
Map1 = game.ServerStorage.Maps.Arena1
NotificationGui1 = game.Workspace.StatusBar.Gui1.TextBox.Text
NotificationGui2 = game.Workspace.StatusBar.Gui1.TextBox.Text
local Player1 = game.Players.LocalPlayer
Winner = "None"
WinnerFound = false
enabled = true
Reciver = game.Workspace.Spawn.Spawn1
--Reciver Vars
Spawn1o = 0
Spawn2o = 0
Spawn3o = 0
Spawn4o = 0
Spawn5o = 0
Spawn6o = 0
function onTouched(part)
local hum = part.Parent:FindFirstChild("Humanoid")
if hum~=nil then
if enabled == true then
enabled = false
local t = part.Parent:FindFirstChild("Torso")
local t2 = Reciver
t.CFrame = CFrame.new(t2.Position.x, t2.Position.y+4, t2.Position.z)
Spawn1o = Spawn1o +1
wait(1)
enabled = true
if Spawn1o == 4 then
Reciver = game.Workspace.Spawn.Spawn2
if Spawn2o == 4 then
Reciver = game.Workspace.Spawn.Spawn3
if Spawn3o == 4 then
Reciver = game.Workspace.Spawn.Spawn4
if Spawn4o == 4 then
Reciver = game.Workspace.Spawn.Spawn5
if Spawn5o == 4 then
Reciver = game.Workspace.Spawn.Spawn6
end
end
end
end
end
end
end
end
game.Workspace.WinnerDetector.Touched:connect(function(Player)
WinnerFound = true
Winner = Player.Parent.Parent.Name
Player.Parent.Humanoid.Health = 0
end)
while true do
NotificationGui1 = "Please Wait"
NotificationGui2 = "Please Wait"
print("Wait60")
wait(60)
NotificationGui1 = "Current Map :", Map1.MapName
NotificationGui2 = "Current Map :", Map1.MapName
print("LoadMap")
wait(5)
NotificationGui1 = "Loading..."
NotificationGui2 = "Loading..."
wait(2)
Map1:clone().Parent = game.Workspace
Player1.PlayerGui.WinnerGui.TextBox.Text = "Teleporting Players"
game.Workspace.TpSender.Touched:connect(onTouched)
wait(24)
NotificationGui1 = "Game In Progress"
NotificationGui2 = "Game In Progress"
game.Players.LocalPlayer.PlayerGui.WinnerGui.TextBox.Text = "Game In Progress"
if WinnerFound then
WinnerFound = false
Player1.PlayerGui.WinnerGui.TextBox.Text = "Winner : ", Winner
game.Workspace.Map:destroy()
Spawn1o = 0
Spawn2o = 0
Spawn3o = 0
Spawn4o = 0
Spawn5o = 0
Spawn6o = 0
NotificationGui1 = "Game Ended"
NotificationGui2 = "Game Ended"
wait(10)
Player1.PlayerGui.WinnerGui.TextBox.Text = "Winner : Not Found"
end
end

4 comments
because local player is local hos, thus your computer is not some else's local host, if you want the code to work either place it in starter gui, starter tools, playerscripts,
on a side note the only real difference from using local script vs script is organization of code handling, and knowing that you placed the right code in the right place,because calling local player simply will be null unless it is in one of the catagories that i have previously mentioned, also it allows the user not to see code through a 3rd party application, in terms of difference vs local scri
Code in a ServerScript runs strictly on the server you are connected to, where as code in a LocalScript will run strictly on the client/player's computer. That is the difference between the two.
@blackJPI I explained that more simple