Help with checkpoint sounds

Yo, does anyone know a script where only the person who steps on a checkpoint hears the noise and not the entire server? I’d be so thankful if somebody could help.:thinking::thought_balloon:

1 Like

You would have to detect when the player touches the checkpoint on the Client Side of Roblox (LocalScripts). That’s really all the guidance I can give you, but I could start you off with a small sample you might be familiar with.,:

local chr = script.Parent
local humanoid = chr:WaitForChild("Humanoid")

local checkpoints = {}

humanoid.Touched:Connect(function(part)
     if part:IsA("Part") then
         -- // play checkpoint noise and code the checkpoint
         -- // also store some of the checkpoints inside of a table, just incase somebody interacts with it again and they respawn somewhere they already have, if you know what I mean. --]]
     end
end)

Im not sure how else this could really be done, unless you use a remote event to play sound effects, using a ClientRemoteEvent, which is fired through the server and will fire the sound on the ClientSide?

3 Likes

Oh how do I use a remote event to play sounds? I was reading a bunch of posts that said I had to put a local script in the screengui but I didn’t know how to do any of that because I’m new to scripting and stuff

If you already use a script per checkpoint then add a localscript for the sound. If youuse one script, create a removeevent. If it fires to the client play the checkpoint sound, meaning all you gotta do is do Remote:FireClient(plr). And make sure Sounds.RespectFilteringEnabled is on.

1 Like

Actually I just thought about something. If I already have a progress bar then I wouldn’t need the checkpoint sounds, would I? I’ll just keep the progress bar with no checkpoint sounds! Also thank you and mystical for the help💯

1 Like

It is not recommended to use ChatGPT for this site. We’re trying to help people, not to make them even more confused.

3 Likes

you can just ask chat gpt for an example and how to make them if you don’t say that chat gpt will just make the whole script

1 Like

SoundService:PlayLocalSound() is probably what you’re looking for
(Just realized that this is a client only method, use a remote to fire the client you want to play the sound for if your code is on the server)

2 Likes

You can just play the sound from ONE LocalScript. No need to use several scripts, or special functions or remotes if you don’t already have them.

local Checkpoints = workspace:WaitForChild("Checkpoints") -- or wherever they’re grouped
local Sound = workspace.CheckpointSound -- or wherever it is located

for _,checkpoint in pairs(Checkpoints:GetChildren()) do
     checkpoint.Touched:Connect(function(Hit)
          if not Sound.IsPlaying then -- prevent it spam playing
              if Hit.Parent.Name == game.Players.LocalPlayer.Name then -- make sure it’s that player that touched it
                  Sound:Play()
              end
          end
     end)
end

P.S; apologies for the indentation. Had to type this from mobile

1 Like

What I checked is your code and Instance names, which are suspicious. Assumed you used it since it’s very similar to what it writes. ClientRemoteEvent doesn’t exist, and if you meant RemoteEvent:FireClient() please write it that way. Also, you don’t check to see if a part that touched the humanoid is a part. Won’t be anything else.

1 Like

Uhhh alright then. My bad for trying to make people understand what I am saying…

Thank you for correcting me.

And yes, what I meant by “ClientRemoteEvent” is RemoteEvent:FireClient().

I could’ve said “The FireClient() function on RemoteEvent” which still would of meant the same thing that I was trying to say.

1 Like

He was right. It’s a typical GPT error to make. Anyone with basic knowledge of GPT and Roblox lua would’ve been able to point that out immediately which is what he did. Whether you did or didn’t the way you reacted is inappropriate.

And no, it wouldn’t have meant the same thing as what you said. As he said, ClientRemoteEvent isn’t even an instance or function. You should’ve specified the function in the first place if that’s what you meant.

1 Like

Well, I don’t have “basic GPT knowledge”, and I don’t think I would need it either to program a game.

The argument was about if I was using ChatGPT, and I had to tell him the truth that I wasn’t. I feel like my “inappropriate” reaction was taken too seriously from you, I was just upset that he would assume I was using ChatGPT, without any evidence, and not even acknowledge that I wasn’t using it.

You are right, I should have specified ‘ClientRemoteEvent’, it would of make it more simpler to understand what I am saying.

At the end, I did not use ChatGPT to write the written code above, I know your not saying I did, but why mention it? So nobody has the wrong interpretation of what happened / what I did. Thats all I have to say.