MouseButton1Click event not firing

Hello everybody, there’s something wrong with this ImageButton firing an event, but i have NO IDEA what. Here’s the code:

LocalScript:

ESkillButton.MouseButton1Click:Connect(function() -- ESkillButton is an ImageButton
	AssignStatEvent:FireServer("Endurance") 
end)

ServerScript:

AssignStatEvent.OnServerEvent:Connect(function(skilltoassign)
	if typeof(skilltoassign) == "string" and skilltoassign == "Endurance" then
		SkillPointsValueSS.Value -= 1
		EnduranceValueSS.Value += 1
		print(SkillPointsValueSS)
		print(EnduranceValueSS)
	end -- no there is no error regarding the lack of ), i'm just including the only relevant if statement in the script

Nothing is coming up in the output, so i’d assume nothing is firing at all. Would love to know if anybody has a solution. Thank you.

Try replacing
AssignStatEvent.OnServerEvent:Connect(function(skilltoassign)
with
AssignStatEvent.OnServerEvent:Connect(function(plr, skilltoassign).

The first parameter of “OnServerEvent” is always the player who fired the event.

3 Likes