I have a shop, and i want when someone buys something or close the shop or open the shop, etc. A random sound will be chosen Example: Close shop = GoodbyeSound, SeeYouLaterSound, SeeyounextimeSound, etc.
Here is my script just in case:
local open = game.Workspace.openPart
local close = game.Workspace.closePart
local frame = script.Parent
local closeButton = frame.closeButton
local buy_1 = frame.buy1
local buy_2 = frame.buy2
local ting = 0
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remoteEvent = ReplicatedStorage:WaitForChild('BuyTool')
local LPlayer = game.Players.LocalPlayer
frame.Visible = false
local function shopMenu(otherPart)
if ting == 0 then
ting = 1
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player == LPlayer then
player.PlayerGui.ScreenGui.Shop.Visible = true
script.Parent.Welcome:Play()
player.Character.Humanoid.WalkSpeed = 0
end
wait(1)
ting = 0
end
end
local function closeMenu() --Updated to use LPlayer
if ting == 0 then
ting = 1
LPlayer.PlayerGui.ScreenGui.Shop.Visible = false
script.Parent.Goodbye:Play()
LPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(close.Position.X,close.Position.Y + 3,close.Position.Z)
LPlayer.Character.Humanoid.WalkSpeed = 16
wait(1)
ting = 0
end
end
local function buyTool1()
local tool = ReplicatedStorage.ShopItems.BloxyCola
remoteEvent:FireServer(tool)
end
local function buyTool2()
local tool = ReplicatedStorage.ShopItems.Coke
remoteEvent:FireServer(tool)
end
open.Touched:Connect(shopMenu)
closeButton.MouseButton1Click:Connect(closeMenu)
buy_1.MouseButton1Click:Connect(buyTool1)
buy_2.MouseButton1Click:Connect(buyTool2)

4 comments
Where can i paste this? Because its bugging my shop
I mean, in which line
at the top a guess
Paste it in your inside closeMenu function line 57