im making a camping game and im working on a exit car button but when I click on it it says this frame is not a valid member of frame here are the 2 local scripts I use
local frame = script.Parent.Parent.frame local open = false
script.Parent.MouseButton1Click:Connect(function() if frame.Visible == false then frame.Visible = true else frame.Visible = false end end)
local character = game.Players.LocalPlayer.CharacterAdded:Wait()
script.Parent.MouseButton1Click:Connect(function()
if character:FindFirstChild("HumanoidRootPart") then
character.HumanoidRootPart.CFrame = CFrame.new(workspace.respawn.position)
end
end)
PS here screenshots https://imgur.com/KokOEwe https://imgur.com/G68Hgo2
Based on the first screenshot, you are looking for a Frame inside of the Frame (literally what the error is telling you) when there isn't one.
On line 1 in the first script, replace script.Parent.Parent.Frame
with script.Parent.Parent
Also, to make it easier for people to read your script, make sure to highlight the text and press the blue Lua button to add a code block, so it will turn the text into a script.