Fire client attempt to index local 'Player' (a nil value)?
Asked by
5 years ago Edited 5 years ago
Fire client attempt to index local 'Player' (a nil value)
Can you help me?
Main Script - Server Script Service
001 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
003 | local PlrCamera = game.Workspace.CurrentCamera |
005 | local ServerStorage = game:GetService( "ServerStorage" ) |
007 | local Status = ReplicatedStorage.Status |
009 | local Player = game:GetService( "Players" ).LocalPlayer |
011 | local MapsFolder = game.ServerStorage.Maps |
017 | if game.Players.NumPlayers < 2 then |
018 | Status.Value = "Waiting for 2 players!" |
020 | repeat wait( 1 ) until game.Players.NumPlayers > = 2 |
022 | Status.Value = "Break 20" |
024 | Status.Value = "Break 19" |
026 | Status.Value = "Break 18" |
028 | Status.Value = "Break 17" |
030 | Status.Value = "Break 16" |
032 | Status.Value = "Break 15" |
034 | Status.Value = "Break 14" |
036 | Status.Value = "Break 13" |
038 | Status.Value = "Break 12" |
040 | Status.Value = "Break 11" |
042 | Status.Value = "Break 10" |
044 | Status.Value = "Break 9" |
046 | Status.Value = "Break 8" |
048 | Status.Value = "Break 7" |
050 | Status.Value = "Break 6" |
052 | Status.Value = "Break 5" |
054 | Status.Value = "Break 4" |
056 | Status.Value = "Break 3" |
058 | Status.Value = "Break 2" |
060 | Status.Value = "Break 1" |
062 | Status.Value = "Break ended" |
064 | Status.Value = "Intermission 10" |
066 | Status.Value = "Intermission 9" |
068 | Status.Value = "Intermission 8" |
070 | Status.Value = "Intermission 7" |
072 | Status.Value = "Intermission 6" |
074 | Status.Value = "Intermission 5" |
076 | Status.Value = "Intermission 4" |
078 | Status.Value = "Intermission 3" |
080 | Status.Value = "Intermission 2" |
082 | Status.Value = "Intermission 1" |
084 | Status.Value = "Intermission" |
086 | game.ReplicatedStorage.IsInGame.Value = true |
090 | for i, player in pairs (game.Players:GetPlayers()) do |
092 | table.insert(plrs,player) |
100 | local AvailableMaps = MapsFolder:GetChildren() |
102 | local ChosenMap = AvailableMaps [ math.random( 1 ,#AvailableMaps) ] |
104 | Status.Value = ChosenMap.Name.. " Chosen" |
106 | local MapSpawn = ChosenMap:Clone() |
107 | MapSpawn.Parent = workspace |
113 | local KillerChosen = plrs [ math.random( 1 ,#plrs) ] |
115 | Status.Value = "The killer is " ..KillerChosen.Name |
117 | table.insert(Killer, 1 ,KillerChosen) |
125 | Killer [ 1 ] .Character:WaitForChild( "HumanoidRootPart" ).CFrame = CFrame.new( 166.4 , 110.3 , 97.6 ) |
127 | game.ReplicatedStorage.CameraKillerBox:FireClient(Player(Player.Parent)) |
129 | print ( "First event fired" ) |
133 | game.ReplicatedStorage.CameraKillerBoxBack:FireClient(Player(Player.Parent)) |
135 | print ( "Second event fired" ) |
Local Script - Starter Gui
01 | local Event = game.ReplicatedStorage.CameraKillerBox |
02 | local Event 2 = game.ReplicatedStorage.CameraKillerBoxBack |
04 | Event.OnClientEvent:Connect( function () |
05 | local KillerCamera = game.Workspace.CurrentCamera |
06 | local Player = game.Players.LocalPlayer |
08 | repeat wait() until Player.Character |
10 | KillerCamera.CameraType = "Scriptable" |
11 | KillerCamera.CFrame = game.Workspace.VeryDarkBox.KillerBoxCameraSurvivors.CFrame |
14 | Event 2. OnClientEvent:Connect( function () |
15 | local KillerCamera = game.Workspace.CurrentCamera |
16 | local Player = game.Players.LocalPlayer |
18 | repeat wait() until Player.Character |
20 | KillerCamera.CameraType = "Custom" |
Fire event doesn't work and please help me with Camera script (Local script) if it have any problems