Bug "model isn't a valid member of player"

Hello, im trying to make a system to locally change transparency of a part in a vehicle using a button in the gui for the driver.

While scripting it using script.Parent.Parent.Parent.Parent.Parent.Body.Frontback.Transparency=0.5 output says this:
It doesn’t make sense since while writing the script body shows up after last parent: image

I tried using workspace.ManCoach.Body.Frontback.Transparency=0.5 but it doesn’t work because spawning system of the game is clone a vehicle from serverstorage and move it to workspace and if there is more than a vehicle spawned at same time it changes transparency of only first one (even if you click while you are in second).
This is the script, only 2 first lines are the important of this post: script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Parent.Body.Frontback.Transparency=0.5
script.Parent.Parent.DisableFrontBack.Visible=true
script.Parent.Visible=false
end)

1 Like

There is no part called body.

R6

Torso

R15

UpperTorso
LowerTorso

1 Like

This is explorer as i forgot to send, there’s a model called body (but its in workspace, not player)image

Use workspace.Body instead of a bunch of parents

As i said, it doesn’t work because it needs to handle more than a player driving

1 Like

I’m confused, you are trying to get a member of a player that isn’t valid but saying it was in workspace. Add the body in starter character

Im trying to change transparency of a workspace part, but for some reason output shows that error that doesn’t match with my script, here is a video of what I’m trying to do but doesn’t work with more than 1 vehicle at same time in the game

LocalScript runs in client side, so the studio game prob bugged and thought the script was running in the player

Do you have any beta features?

Ok, so, any idea of what i can do to solve it? I need to use anyways a server script instead of local or maybe file a bug report?

nope, i don’t right now (i did in the past)

Are you on the latest update? If you aren’t maybe you should run it as a script then if it doesn’t work file a bug report

Indeed, i’m, gonna file a bug report, thanks for the help

Can you insert print(script:GetFullName()) in the connected funciton and show me what it prints?

script.Parent.MouseButton1Click:Connect(function()
    print(script:GetFullName())
    script.Parent.Parent.Parent.Parent.Parent.Body.Frontback.Transparency=0.5
    script.Parent.Parent.DisableFrontBack.Visible=true
    script.Parent.Visible=false
end)

image

That code printed where the script is running.
Players.iagocity2005.PlayerGui[“Chassis Interface”].ScreenGui.EnableFrontBack.LocalScript.

The issue is coming from this line:
script.Parent.Parent.Parent.Parent.Parent.Body.Frontback.Transparency=0.5

If we follow that up the hierarchy we get
Script = LocalScript
Parent1 = EnableFrontBack
Parent2 = ScreenGui
Parent3 = Chassis Interface
Parent4 = PlayerGui
Parent5 = iagocity2005

There is where you stop rising in the game tree and start moving back down. The issue is that you are searching for Body of the car under the location ‘game.Players.iagocity2005’ which is a player object causing you to get that error. You are going to have to grab it through a more absolute method in order to get it, like calling it from workspace.

With your earlier attempt only changing a single car, it’s due to the fact that they share the same fullName so roblox only returns the first one. To fix that you will need to find a way to either name them differently or send the information on which vehicle through another way. I don’t know enough about how your gui gets sent to the playerGui, but if I had to guess I’d say it’s from when a player sits in the driver seat. If that’s the case you could fix the issue by sending the variable information of the vehicle along with the scripts and stuff. (Like sticking an object value in the screen gui for the other script to read or using remote events)

1 Like

make sure the model “Body” is Archivable. It will show up in scripting even if it isn’t, but it will not be considered a valid member in game.