Still have questions? Join our Discord server and get real time help.
Log in to vote

How to script a simulator shop on touch?

Asked by
zapzser -3
13 days ago

I have tried many other codes others have offered me but non have worked for an ontouched shop. This is my script:

local taken = false

    if hit then
        if hit.Parent:FindFirstChild("Humanoid") then
            if taken == false then
                taken = true
                local plr = players:GetPlayerFromCharacter(hit.Parent)
                game.ReplicatedStorage.Gui:FindFirstChild("Shop"):Clone().Parent = plr.PlayerGui.Shop.Frame
                taken = false

1 answer

Log in to vote
Answered by 13 days ago

From what I see, it seems like you're trying to make it so that whenever you touch a certain part, your shop GUI pops up. If you're trying to make this, you don't need this complicated of a script at all. Make a ScreenGui in StarterGui and move your GUI you want to pop up there. In it, you're going to insert a LocalScript. After that, make sure you have a part in the Workspace that you want the player to step on.

All you need to do is:

 --this creates an event for when the part is touched and connects it to a function so we can make changes. Change "Part" to whatever your part is named.
    --This makes the GUI that is the LocalScript's parent's visibility to true.
    script.Parent.Visible = true 

This would be the most simple way to do that, but there are more advanced ways that you can do it too!

It is still not working zapzser -3 — 10d

Answer this question