Ad
Log in to vote
1

How to make shop open when npc is clicked?

Asked by 3 days ago

Basically I want it so that a shop gui is opened in my game when an npc is clicked. I suck with guis, and im also a new scripter though, so i dont know how. basically, you click on an npc and then a shop gui opens with like a working x and buy button. help appreciated

0
Just add a click detector to the NPC and make it when clicked it sets the players UI to enabled. This is achievable in a LocalScript. If you need help I can write an answer. DrShockz 213 — 3d
0
I've never used click detectors- I'd appreciate it if you could write an answer dylindude 64 — 3d

1 answer

Log in to vote
0
Answered by
xxaxxaz 38
3 days ago

make your model/npc, place down a new part, make it transparent and move the position to the same position as the humanoid root part of the model/npc. add a normal script and rename it to Shop. add a new ProzimityPrompt that has the propertys you want it to have but the parent must be the part. now add a screen gui at startguis, rename that one Shop, add a frame to the Shop gui and rename the frame to Shop to.

shop script:

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
    game.StarterGui.Shop.Shop.Visible = true
end)

then to close it you can make a X button on the top right or left side of the screen and add this script to it.

script.Parent.Activated:Connect(function(player)
    script.Parent.Parent.Visible = false
    game.Workspace[player.Name].Humanoid.WalkSpeed = 30--the amount of speed the players start with.
end)
0
Where to I add the normal script? dylindude 64 — 2d
Ad

Answer this question