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

Shop Gui when you touch a brick?

Asked by 5 years ago

Okay so heres the deal, i have the kinqandis shop plugin to help me set up the scripts because it saves me time. But i wanted to make it in a cashier so what i'm doing is using a birck so when they touch it it Opens the shop gui the script in the brick is the first code i posted its a copy and pasted version of whats in the gui which is the second one i posted. I don't know why but when i step on the Part that opens the gui it says Shop is not a valid member of workspace. Now I completly understand I barely explained that at all so just reply if you have questions ill be happy to awnser them!

`` function onTouched(Check1) if script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, -500) then repeat script.Parent.Parent.Shop.Position = script.Parent.Parent.Shop.Position + UDim2.new(0, 0, 0, 50) script.Parent.Parent.Inventory.Position = script.Parent.Parent.Inventory.Position + UDim2.new(0, 0, 0, 50) wait(.01)

        script.Parent.Text = "Shop(Close)"
    until script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, 100)
elseif script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, 100) then

    repeat
        script.Parent.Parent.Shop.Position = script.Parent.Parent.Shop.Position - UDim2.new(0, 0, 0, 50)
        script.Parent.Parent.Inventory.Position = script.Parent.Parent.Inventory.Position - UDim2.new(0, 0, 0, 50)
        wait(.01)
        script.Parent.Text = "Shop(Open)"
    until script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, -500)
end

end

script.Parent.Touched:Connect(onTouched)

``script.Parent.MouseButton1Down:connect(function() if script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, -500) then repeat script.Parent.Parent.Shop.Position = script.Parent.Parent.Shop.Position + UDim2.new(0, 0, 0, 50) script.Parent.Parent.Inventory.Position = script.Parent.Parent.Inventory.Position + UDim2.new(0, 0, 0, 50) wait(.01)

        script.Parent.Text = "Shop(Close)"
    until script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, 100)
elseif script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, 100) then

    repeat
        script.Parent.Parent.Shop.Position = script.Parent.Parent.Shop.Position - UDim2.new(0, 0, 0, 50)
        script.Parent.Parent.Inventory.Position = script.Parent.Parent.Inventory.Position - UDim2.new(0, 0, 0, 50)
        wait(.01)
        script.Parent.Text = "Shop(Open)"
    until script.Parent.Parent.Shop.Position == UDim2.new(0, 500, 0, -500)
end

end)

0
the code kind of cut out Canyon620_YT 5 — 5y
0
can you make it more readable Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I can barely read the code, but I think I may know what is wrong.

If the script is saying "Shop is not a valid member of Workspace." Then "script.Parent.Parent.Shop" probably does not exist or it isn't named properly.

Make sure there is (likely a ScreenGUI) an object called "Shop" inside of the parent of the script's parent.

Ad

Answer this question