So I want to figure out from when you touch a part a sound plays, but if you touch the part again it doesn’t play anymore, and if you reset and touch the part it still doesn’t play, so I like want to when you touch the part the sound only plays ONCE per client.
Do you have a script for it yet?
If so, please show it.
Edit: what I would do is create boolvalue inside of the part then call the boolvalue “Touched” then whenever the player touches the part it checks if the boolvalue is true, if it is not true then it will play the sound then make the boolvalue true
local Sound = (sound) (code when the player touches the part):Connect(function() if script.Parent.Touched.Value = false then Sound:Play() else end
Hopefully this is a solution, you will need to put the desired sound in serverstorage, then clone it via script. Make a
.Touched even and then put
That’s also a good idea, put a boolvalue which will kinda add a delay to check if canPlay = true
I do yes, but its in the part and its a normal script
I kinda already did from when you touch the part it works and when u touch the part again it doesn’t work, but I don’t have the when u leave the game and join back and then touch the part, I like want the script to stop for the client
I’m not sure if that is possible then.
Also, you don’t need to parent the sound to the gui, just parent it to the part then after the cool down parent it back to the workspace.Sounds
I’m pretty sure it is, in some obby games when u touch the checkpoint it only plays once and after that u can’t hear it
I’m pretty sure that’s because it is a checkpoint.
checkpoint is still a part or a union
Change the function line to:
script.Parent.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChildWhichIsA("Humanoid") if hum and Played then Played = false local Player = game.Players:GetPlayerFromCharacter(hum) local Sound = game.Workspace.Sounds.Sound1:Clone() Sound.Parent = Player:WaitForChild("PlayerGui") Sound:Play() Played = true wait(3) Played = false end end)
it’s supposed to be GetPlayerFromCharacter(hum)
you misspelled it.
Did my script work???
hold upp im gonna go test it but does it need to be inside of the part?
This text will be hidden
Yes, It does. That’s what you wanted right?
local Part = script.Parent local Played = false Part.Touched:Connect(function(hit) if hit and hit.Parent:FindFirstChild("Humanoid") then local plr = game.Player:GetPlayerFromCharacter(hit.Parent) plr.PlayerGui.YourSound:Play() Played = true wait(5) Played = false end end)
Where is this variable?
It does work thanks you so much, I appreciate it!
You’re welcome, glad I could help