In server scripts you can't do this:
local plr = game.Players.LocalPlayer
How would I fire a client event if I can't use that? I want to fire a client event without a function that gets the local player such as player entering, player removing, etc
I tried to do this before but it didn't let me.
Well, if you want to get the player in the server using RemoteEvents without using functions like that, I guess you can do something like this :
local plr = game.Players.LocalPlayer local event = game.ReplicatedStorage.RemoteEvent -- RemoteEvent in ReplicatedStorage event:FireServer(plr)
local event = game.ReplicatedStorage.RemoteEvent -- RemoteEvent in ReplicatedStorage local player -- Variable to save "plr" event.OnServerEvent:Connect(function(plr) print(plr) player = plr end)
As soon as the local script runs those lines of code, it'll fire the LocalPlayer using a RemoteEvent in ReplicatedStorage. The server script then detects the fire, gets the LocalPlayer, then saves it in the "player" variable. You'll then be able to mess around with the player and etc.
Hope this helped!