I’ll do that once I get the script to actually detect the event in the first place, but thanks.
Worth mentioning that you could do this without the remote entirely, unless there’s something I’m unaware of in which you need the server involved. The client can check a part touch and then decide to play the sound. Only extra step needed would be to validate that touches on the part came from the LocalPlayer’s character.
Maybe because it’s a localscript? I’m not a good scripter.
I get confused there myself, actually you can detect the player from their character and put the sound in their player object, then plays it. That should work unless there’s a more efficient way.
Yeah, I was thinking I should just move everything over to a LocalScript instead and save myself the hassle, but it’s still worth figuring out why this isn’t working for when I need to use RemoteEvents in the future, right?
Well, no, that wouldn’t fix it at the moment, because as I’ve said numerous times, the LocalScript isn’t even being triggered in the first place, as none of the print statements inside it are firing.
You don’t need the LocalScript, you can do that in the touched function even though it’s the normal type. Have you heard of game.Players:GetPlayerFromCharacter() atleast once? Pretty much all you need to do is type the character object (e.g. hit.Parent, part.Parent, etc) inside the brackets. I’m not sure if this will work correctly nor properly so it’s up to you if you’ll use this or not.
…Yes, I’m well aware of that. You still aren’t understanding the issue I’m having. I’m detecting the player just fine, like I said, everything in the script inside the trigger part works fine. It’s just when it fires the RemoteEvent, the LocalScript doesn’t detect it. And, no, I do need the LocalScript, because that’s the only way to play a sound for the local user only, as far as I’m aware.
Is the LocalScript in StarterPlayerScripts? If it is then I pretty much ran out of solutions.
Yes. I said that in my original post.
Is there any errors in the output? You provided plr and SoundId when you FireClient() but the function which handles the FireClient() only handles SoundId and Volume. I don’t know if that’s the case since it’s supposed to prints an error saying SoundId is invalid.
When it comes to RemoteEvents I usually just connect the function first (e.g. OnClientEvent:Connect(function(argument1,argument2, etc)
) so I don’t know about writing separate function and connecting it later.
Sorry if I provide no help at all.
There are no errors in the output, no. And the SoundId and Volume arguments shouldn’t matter, since even if they were incorrect, it’d at least fire, right? There is output from the print statements in the serverside script, and that’s it. No errors, nothing.
Are all of these happening in one LocalScript?
All of what? I included snippets of my scripts in the OP, including the entire LocalScript. Please read them.
Oh sorry my native language isn’t English so I have a hard time understanding them. That’s probably all I can do. Try giving the solution I talked about a shot or wait for other possible solutions. Good luck!
I’m going to try putting everything inside a LocalScript later tonight, but I’d still appreciate advice on how to get this working, as I’m probably going to need to use RemoteEvents at some point in the future, anyway.
I’m gonna go with this for now, but do you have anywhere I can look for more info on having the player check if a specific part has been touched in a LocalScript? I can’t seem to find anything on it, but I might just be looking in the wrong places.
This tutorial I wrote a while back might be helpful:
Thanks! I’ll give it a look. If it ends up working, I’ll probably mark this as the solution.
This has been a big help, but I’m struggling to figure out how to specify in the LocalScript which specific part I want to trigger it. I know I should put the part inside a variable, like ‘triggerPart’, but… I don’t know what to put in that variable, if you get what I mean.
EDIT: Nevermind, I figured it out. Roblox Studio was just telling me ‘Workspace.teleportTrigger’ was deprecated, and to use ‘workspace.teleportTrigger’ instead, which… didn’t work.