Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Beacon is not a valid member of Players?

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.

5 comments

0

This code is giving me a headache.

0

It looks like that, but the code block's size puts some lines below.

0

Ultimate parentception

0

Yes, I just didn't feel like shortening it by adding something like this Beacon = script.Parent.Parent.Parent and etc

0

You're trying to find the beacon in Players instead of Workspace

1 answer

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.

2 comments

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.

0

Clearly you are: Beacon is not a valid member of PLAYERS

This discussion is preserved as it was. New answers, comments, and votes are closed.