I'm using a local script in starterGui to send a players name to a server script using a remote event, everything is working so far, the server script is getting the players name but it can't find the players character in the workspace, It seems like it should and it's probably something really simple I just can't stop, could someone tell me why it won't?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")
local function Event(player)
print(player)
local PlayerCharacter = game.Workspace:WaitForChild(player)
print(PlayerCharacter)
local Headlamp = PlayerCharacter:FindFirstChild("Headlamp")
local LightEmitter = Headlamp:FindFirstChild("LightEmitter")
local Spotlight = LightEmitter:FindFirstChild("SpotLight")
if Spotlight.Enabled == false then
Spotlight.Enabled = true
else
if Spotlight.Enabled == true then
Spotlight.Enabled = false
end
end
end
Remote.OnServerEvent:Connect(Event)
It's on line 9

2 comments
Yes, thankyou so much
marking this as answered since you said that.