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

Why doesn't this remote event work? No error in the output.

I want to make a RemoteEvent which will reset the player's Stage stats to 1. This however is not working. So I made a ScreenGui and used a RemoteEvent and picked up that event in a serverScript. No errors in the output have shown.

Local Script

local button = script.Parent.Button

button.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.SettingsEvents.ResetStats:FireServer(game.Players.LocalPlayer.leaderstats.Stage.Value)
	print("Button clicked ree.") --//This works perfectly fine.
end)

Server Script

local rE = game:GetService("ReplicatedStorage")
local setEvents = rE.SettingsEvents

setEvents.ResetStats.OnClientEvent:Connect(function(plr,StageVal)
	print(plr.Name.." set off the reset stats event.") --//This does not print fsr
	plr.leaderstats.Stage.Value = 1
end)

Thanks for taking your time. Any answers are appreciated.

1 answer

✓ Accepted answer

Ok you fired a server in the localscript and you used OnClientEvent in the server

4 comments

0

I'm so dumb I didn't even realise that. I can't believe i didn't see that. Thanks a lot though for taking your time!

0

Welcome!

0

The first argument of OnServerEvent is the player that fired the event. After is the argument that you have sent by the client.

0

Thanks for the reputation btw!

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