Hello!
I'm trying to make a round system for my wars game. For that, I need to acces LocalPlayer by a normal script in ServerScriptService. the script is the following:
wait(20)
local PlayerService = game:GetService("Players")
local Player = PlayerService:GetPlayers()
local function toround()
game.Workspace.Rift.Rift.Rift.TimePosition = 9.5
game.Workspace.Rift.Rift.Rift:Play()
game.Workspace.Rift.Rift.Transparency = 0
Player.Character.HumanoidRootPart.CFrame = game.Workspace.Rift.Rift.CFrame
wait(5)
game.Workspace.Rift.Rift.Transparency = 1
end
local function tolobby()
Player.Backpack:ClearAllChildren()
Player.Character.Humanoid.Health = 100
game.Workspace.Lobby.LobbyRift.Rift.Rift.TimePosition = 9.5
game.Workspace.Lobby.LobbyRift.Rift.Rift:Play()
game.Workspace.Lobby.LobbyRift.Rift.Transparency = 0
Player.Character.HumanoidRootPart.CFrame = game.Workspace.Lobby.LobbyRift.Rift.CFrame
wait(5)
game.Workspace.Lobby.LobbyRift.Rift.Transparency = 1
game.Workspace.Drop.Drop.ReEnable.Disabled = true
game.Workspace.Drop.PositionRift.Transparency = 1
game.Workspace.Drop.Laser.Transparency = 1
game.Workspace.Drop.Parachute.Transparency = 1
game.Workspace.Drop.Drop.Transparency = 1
game.Workspace.Drop.Drop.Move.Disabled = true
game.Workspace.Drop.Drop.System.Disabled = true
game.Workspace.Drop.Drop.Reset.Disabled = true
game.Workspace.Drop.Drop.ReEnable.Disabled = true
game.Workspace.Drop.Drop.BillboardGui.Enabled = false
end
local function startdrop()
game.Workspace.Drop.Drop.ReEnable.Disabled = false
end
local Value = script.Value.Value
local Gamemodes = script.Parent.Gamemodes
--Start cycle
tolobby()
while true do
Value = math.random(1, 9)
if Value == 1 then
wait(10)
Gamemodes.OnlyARsMode["[NON VIP] Assault rifle"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyARsMode["[NON VIP] Burst assault rifle"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyARsMode["[NON VIP] Med kit"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyARsMode["[NON VIP] Parachute"]:Clone().Parent = Player
toround()
wait(20)
Value = 0
return tolobby()
end
if Value == 2 then
wait(10)
Gamemodes.OnlySMGsMode["[NON VIP] Burst submachine gun"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySMGsMode["[NON VIP] Fast fire submachine gun"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySMGsMode["[NON VIP] Submachine gun"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySMGsMode["[NON VIP] Suppresed submachine gun"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySMGsMode["[NON VIP] Med kit"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySMGsMode["[NON VIP] Parachute"]:Clone().Parent = Player
toround()
wait(20)
Value = 0
return tolobby()
end
if Value == 3 then
wait(10)
Gamemodes.OnlyShotgunsMode["[NON VIP] Pump shotgun"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyShotgunsMode["[NON VIP] Tactical shotgun"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyShotgunsMode["[NON VIP] Med kit"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyShotgunsMode["[NON VIP] Parachute"]:Clone().Parent = Player
toround()
wait(20)
Value = 0
return tolobby()
end
if Value == 4 then
wait(10)
Gamemodes.OnlySNRsMode["[NON VIP] Sniper rifle"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySNRsMode["[NON VIP] Med kit"]:Clone().Parent = Player.Backpack
Gamemodes.OnlySNRsMode["[NON VIP] Parachute"]:Clone().Parent = Player
toround()
wait(20)
Value = 0
return tolobby()
end
if Value == 5 then
wait(10)
startdrop()
Gamemodes.OnlyDropsMode["[NON VIP] Parachute"]:Clone().Parent = Player.Backpack
toround()
wait(20)
Value = 0
return tolobby()
end
if Value == 6 then
wait(10)
Gamemodes.OnlyPistolsMode["[NON VIP] Pistol"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyPistolsMode["[NON VIP] Suppresed pistol"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyPistolsMode["[NON VIP] Med kit"]:Clone().Parent = Player.Backpack
Gamemodes.OnlyPistolsMode["[NON VIP] Parachute"]:Clone().Parent = Player.Backpack
toround()
wait(20)
Value = 0
return tolobby()
end
if Value == 7 or 8 or 9 then
wait(10)
startdrop()
Gamemodes.ClassicMode["[NON VIP] Assault rifle"]:Clone().Parent = Player.Backpack
Gamemodes.ClassicMode["[NON VIP] Burst assault rifle"]:Clone().Parent = Player.Backpack
Gamemodes.ClassicMode["[NON VIP] Pump shotgun"]:Clone().Parent = Player.Backpack
Gamemodes.ClassicMode["[NON VIP] Tactical shotgun"]:Clone().Parent = Player.Backpack
Gamemodes.ClassicMode["[NON VIP] Submachine gun"]:Clone().Parent = Player.Backpack
Gamemodes.ClassicMode["[NON VIP] Med kit"]:Clone().Parent = Player.Backpack
Gamemodes.ClassicMode["[NON VIP] Parachute"]:Clone().Parent = Player
toround()
wait(20)
Value = 0
return tolobby()
end
wait()
end
Is there any way to acces LocalPlayer by a normal script in the ServerScriptService?

3 comments
It is not possible to do this from a server script without the use of remote bindables.
No
Could you show us what events are going to trigger these function to occur? If so, I may be able to change up the script so that a remote event can pass through and fix your issue.