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

Frame is not valid member of frame?

Asked by 6 years ago

I'm creating a give system which the barista sends the item to the player (cafe game) and a gui pops up saying yes, no, I didn't order that. It only works in-studio but not in-game. Error: http://prntscr.com/iz4gey Explorer objects: http://prntscr.com/iz4gom Inside the buttons are just localscripts.

script.Parent.Frame.Holder:TweenPosition(UDim2.new(0,0,0,0), "In", "Linear", .3, true)
script.Parent.AnswerHolder.y:TweenPosition(UDim2.new(0, 0,0.005, 0), "Out", "Linear", .3, true)
script.Parent.AnswerHolder.w:TweenPosition(UDim2.new(0, 0,0.717, 0), "Out", "Linear", .3, true)
script.Parent.AnswerHolder.n:TweenPosition(UDim2.new(0, 0,0.364, 0), "Out", "Linear", .3, true)
local barista = script.Parent.Parent:WaitForChild("barista")
local item = nil

for i,v in next, script.Parent.Parent:GetChildren() do
    if v.ClassName == "Tool" then
        if v:FindFirstChild("topbun") == nil then
            item = v
        else
            item = game.Lighting[v.Name]:Clone()
        end
    end
end

function onYes()
    Workspace.GiveSystem.AddPoint:FireServer(script.Parent.Parent.barista.Value)
    item.Parent = game.Players.LocalPlayer.Backpack
    script.Parent.AnswerHolder.y:TweenPosition(UDim2.new(-1, 0,0.005, 0), "Out", "Linear", .3, true)
    script.Parent.AnswerHolder.n:TweenPosition(UDim2.new(-1, 0,0.364, 0), "Out", "Linear", .3, true)
    script.Parent.AnswerHolder.w:TweenPosition(UDim2.new(-1, 0,0.717, 0), "Out", "Linear", .3, true)
    script.Parent.Frame.Holder:TweenPosition(UDim2.new(1,0,0,0), "In", "Linear", .3, true)
    wait(1)
    script.Parent:Destroy()
end

function onWrong()
    Workspace.GiveSystem.RevokePoint:FireServer(script.Parent.Parent.barista.Value)
    script.Parent.AnswerHolder.y:TweenPosition(UDim2.new(-1, 0,0.005, 0), "Out", "Linear", .3, true)
    script.Parent.AnswerHolder.n:TweenPosition(UDim2.new(-1, 0,0.364, 0), "Out", "Linear", .3, true)
    script.Parent.AnswerHolder.w:TweenPosition(UDim2.new(-1, 0,0.717, 0), "Out", "Linear", .3, true)
    script.Parent.Frame.Holder:TweenPosition(UDim2.new(1,0,0,0), "In", "Linear", .3, true)
    wait(1)
    script.Parent:Destroy()
end

function onNo()
    script.Parent.AnswerHolder.y:TweenPosition(UDim2.new(-1, 0,0.005, 0), "Out", "Linear", .3, true)
    script.Parent.AnswerHolder.n:TweenPosition(UDim2.new(-1, 0,0.364, 0), "Out", "Linear", .3, true)
    script.Parent.AnswerHolder.w:TweenPosition(UDim2.new(-1, 0,0.717, 0), "Out", "Linear", .3, true)
    script.Parent.Frame.Holder:TweenPosition(UDim2.new(1,0,0,0), "In", "Linear", .3, true)
    wait(1)
    script.Parent:Destroy()
end

script.Parent.AnswerHolder.y.MouseButton1Click:connect(onYes)
script.Parent.AnswerHolder.n.MouseButton1Click:connect(onNo)
script.Parent.AnswerHolder.w.MouseButton1Click:connect(onWrong)
0
You missed something, put the localscript in the Frame's parent and should be fixed. monchaso 0 — 6y
0
Use :WaitForChild("Frame") instead of script.Parent.Frame. This should work. y3_th 176 — 6y

Answer this question