Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Beacon is not a valid member of Players?

Asked by 6 years ago
script.Parent.MouseButton1Click:connect(function()
  print("Light on Clicked")
script.Parent.Parent.Parent.Parent.Parent.Beacon.Mechanism.Light.Material = Enum.Material.Neon
script.Parent.Parent.Parent.Parent.Parent.Beacon.Mechanism.Light.SpotLight.Enabled = true
script.Parent.Parent.Parent.Parent.Parent.Beacon.Mechanism.MotorPart.BottomSurfaceInput = "Constant"
  print("Light in action")
end)

The GUI is in a vehicleseat. I have figured out how to make it open on seat, but what I want this to do is when this GUI button is pressed, that it makes the beacon's light material neon, and enables spotlight inside it, and makes the bottomsurfaceinput turn into Constant, so that it spins (yes I use old motor constraints). When i press it in play mode, the output says that beacon is not a valid member of players. Can you fix this for me please? It's all grouped.

0
This code is giving me a headache. DinozCreates 1070 — 6y
0
It looks like that, but the code block's size puts some lines below. NewBuildmini 5 — 6y
0
Ultimate parentception GamingOverlord756 48 — 6y
0
Yes, I just didn't feel like shortening it by adding something like this Beacon = script.Parent.Parent.Parent and etc NewBuildmini 5 — 6y
0
You're trying to find the beacon in Players instead of Workspace awesomeipod 607 — 6y

1 answer

Log in to vote
0
Answered by
Vmena 87
6 years ago
Edited 6 years ago

You have one extra Parent, so the Parent of your Player is Players. Remove one of the parents and it should work just fine.

The better way to get the player would be using the code below:

local Player = game.Players.LocalPlayer

Then you can just do Player.Beacon and not worry about all those Parents.

0
The beacon isn't inside the player, the seat and beacon is inside a model inside workspace. I don't understand what are you talking about. NewBuildmini 5 — 6y
0
Clearly you are: Beacon is not a valid member of PLAYERS LisaF854 93 — 6y
Ad

Answer this question