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

Remote event not working correctly?

I have the client firing text and a sound to the server and then the server receiving that but somethings wrong and I can't explain it. At the client I have this =

TheEvent:FireServer("Run", script.Parent.Head.Sprint)

And at the server I have this =

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(text, sound)
	print("received something")
	if text == "Run" then
		print("run")
		sound:Play()
	else
		print("not 'run'")
	end
end

The server does receive the event but it prints "not 'run'", even though "Run" was fired. I have also tried this =

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(...)
	print("received something")
	local values = { ... }
	if values[1] == "Run" then
		print("run")
		values[2]:Play()
	end

It didn't work. Neither of them ever print "run".

4 comments

0

The OnServerEvent Signal provides the Client Instance that fired the Remote, then the following arguments given.

0

You don't seem to need it, so we can just write function(_, Text, Sound).

0

Ty, it worked, now post that as an answer so I can mark it

0

Done!

1 answer

✓ Accepted answer

The OnServerEvent Signal provides the Client Instance that fired the Remote, then the following arguments given. You don't seem to need it, so we can just write function(_, Text, Sound).

Remember to accept the answer if is it helpful!

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