Hello devs, i just made an Screen GUI, and the function that i want to do is play a sound on humanoid when you click on the GUI.
How i can do that?
Any script will be Helpful!
Hello devs, i just made an Screen GUI, and the function that i want to do is play a sound on humanoid when you click on the GUI.
How i can do that?
Any script will be Helpful!
Hi, Add this local script into a button Inside of the local script add the sound
local sound = script.Sound
local Player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local soundclone = sound:Clone()
soundclone.Parent = Player.Character.Humanoid
soundclone:Play()
end)
I mean I don’t rlly want to give you a free bee on this one because you wouldn’t be learning much. But I hope you can learn from it.
(Put this in a local script)
local Button = script.Parent --- Your Button
local plr = game.Players.LocalPlayer --- The Client
Button.MouseButton1Click:Connect(function() --- Fires when a plr clicks the button
local Sound = game.replicatedstorage.Sounds.Audio:Clone() --- Change this to the sound
local char = plr.Character --- Defines the character
sound.Parent = char:FindFirstChild("Humanoid") --- Parents the Audio to the humanoid
sound:Play() --- Plays the sound.
end) --- Closes the function.
The local script will make only me hear the sound?
Yeah it will make you only hear the sound because local script = client (your computer/device)