Body is not a valid member of Players.vxcaie (me)

I want to make a turn signals to put into my A-Chassis v.AC6C, like some of my other posts, it doesn’t work. I use a RemoteEvent and 3 scripts from a YouTube tutorial I found. Obviously, it didn’t help. Here is the information:

Put into the Plugins folder:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Z then
		script.Parent:WaitForChild("Left"):FireServer()
	elseif input.KeyCode == Enum.KeyCode.C then
		script.Parent:WaitForChild("Right"):FireServer()
	end
end)

A script inside a RemoteEvent named ‘right’.

script.Parent.OnServerEvent:Connect(function()
    script.Parent.Parent.Parent.Parent.Body.Body["Car Model"].Blinkers.Li.Light = not script.Parent.Parent.Parent.Parent.Body.Body["Car Model"].Blinkers.Li.Light	
end)

A script inside the blinker model:

while true do
	wait()
	if script.Parent.Parent.Light.Value == true then
		script.Parent.Material = "Neon"
	else
		script.Parent.Material = "Neon"
	end
end

This is for the right blinker, it’s pretty much copy-and-paste for the right one.

Thanks, @vxcaie, a programmer/scripter in the ROBLOX community.

2 Likes

Try using a few variables that actually wait for stuff to exist before trying to reference them.


local parent = script.Parent
local mainModel = parent.Parent.Parent
local body = mainModel:WaitForChild('Body')
local subBody = body:WaitForChild('Body')
local carModel = subBody:WaitForChild('Car Model')
local blinkers = carModel:WaitForChild('Blinkers')
local li = blinkers:WaitForChild('Li')
local lights = li:WaitForChild('Lights')
1 Like

It prints this strangely…

And also doesn’t work.

1 Like

Is there a ScreenGui just labeled “Body” in PlayerGui or does that lead nowhere?

Something must be mislabeled or doesn’t exist.

2 Likes

No, It is a model.
image

2 Likes

I’m working on limited info here lol

I wasn’t saying to just blindly cut and paste my variables into your script, you have to label the WaitForChilds properly for the paths they’re in. Accurate names, locations, and all that jazz

2 Likes

The lights turn on (SmoothPlastic is regular) but I have no control over them.

script.Parent.OnServerEvent:Connect(function()
	local parent = script.Parent
	local mainModel = parent.Parent.Parent
	local body = mainModel:WaitForChild('Body')
	local subBody = body:WaitForChild('Body')
	local carModel = subBody:WaitForChild('Car Model')
	local blinkers = carModel:WaitForChild('Blinkers')
	local li = blinkers:WaitForChild('Li')
	local lights = li:WaitForChild('Light')
	lights.Value = not lights.Value
end)
while true do
	wait()
	script.Parent.Parent.Light.Value = true
	if script.Parent.Parent.Light.Value == true then
		script.Parent.Material = Enum.Material.Neon
		script.Parent.Parent.Light.Value = false
		wait(2)
	elseif script.Parent.Parent.Light.Value == false then
		script.Parent.Material = Enum.Material.SmoothPlastic
	end
end
2 Likes

Is the car in/moved to the workspace anywhere? could be that you have to set the lights’ network owner as the player.

for i,part in pairs(carModel:GetDescendants() do
     if part:IsA('BasePart') then
          part:SetNetworkOwner(LocalPlayer)
     end
end