.OnSeverEvent Issues

Alright so, I’ve made a very simple script.
So basically when you click a button in the GUI, the remoteevent fires and in a seperate script i have the .OnServerEvent script which prints (plr.Name), and this works in solo testing but when i do a local server test with 2 players it doesnt work.
Can someone help me understand why?

My scripts:

Fire Server Script (LocalScript)

script.Parent.MouseButton1Click:Connect(function()  
	game.ReplicatedStorage.Clothes.Events.PotHelmet:FireServer()
end)

On Server Event (Script inside ServerScriptService

local events = game.ReplicatedStorage.Clothes.Events
local unifs = game.ReplicatedStorage.Clothes


events.PotHelmet.OnServerEvent:Connect(function(plr)
print(plr.Name)
end)

pls help

Try changing the first line of the server script to:
local events = game.ReplicatedStorage.Clothes:WaitForChild("Events")

Still refuses to print the name of the plr who activated the event. Even tho it works in solo testing, could it be maybe cause it doesn’t work bcs maybe the “player1” and “player2” names dont work with scripts or smthn i dunno.

Listen yo, your LocalScript, where is it parented to bro? Is it under StarterPlayer or workspace?

image
It’s the “FireServer” script which was kinda implied but just wanted to make sure

Maybe wait for the PotHelmet event on the client using WaitForChild.

Most likely the issue is that you are looking at the client console. When you start testing in the studio, the following windows are created: the server and the number of clients that you specified. On the client console, you can’t see what the server is typing, so check the console of 3rd window that open with the clients.

1 Like

This works :pray: thx for helping me out here!

1 Like

you’re welcome!ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.