Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sound in player GUI wont play?

A sound isn't playing when I step on the block meant to trigger it. There aren't any output errors, and experimental mode is on so filtering enabled shouldn't be a problem. Here's the code. EDIT: It works in studio just not online

local part = script.Parent
local players = game:GetService("Players")
local played = false

part.Touched:connect(function(hit)
	local char = hit.Parent 
	if char.Humanoid and played == false then
		local plr = players:WaitForChild(char.Name)
		plr.PlayerGui.Sounds.windows:Play()
			played = true
			wait(5)
		end
end) 

2 comments

0

is it in a localscript?

0

No its just in a Script

1 answer

First make a sound in the Workspace, Next change the sound properties to your desire. Paste this code in the same script: And then change "SOUND" to the name of the object.

local part = script.Parent local players = game:GetService("Players") local played = false

part.Touched:connect(function(hit) local char = hit.Parent if char.Humanoid and played == false then local plr = players:WaitForChild(char.Name) game.Workspace.SOUND:Play() played = true wait(5) end end) -- If This Is Used In A Free Model | CREDIT ME! -- It Is Rude To Delete This Line -- -- Made By minecraftisawsome17 --

This discussion is preserved as it was. New answers, comments, and votes are closed.