I think I know how, but for some reason whatever code I put to do when an event is fired doesn't happen. "triedtochange" is printed. I have event2 fire when a player joins and when they use this button, but for some reason it only does the print function and nothing else. The buttons are in a frame in startergui which is placed on a part.

local evnt2 = game.Workspace.event2
local button = script.Parent
local sword = "Lumina"
local price = 2000

button.MouseButton1Click:Connect(function(sword, price)
	local sword = "Lumina"
	local price = 2000
	local tix = game.Players.LocalPlayer.leaderstats.Tix
	if tix.Value >= price then
		
		evnt2:FireServer(sword, price)
		print("detected click")
	end
	
end)
evnt2.OnClientEvent:Connect(function(sent)
	
		if sent == sword then
			print("triedtochange")
			button.Visible = false
			script.Parent.Parent:FindFirstChild("buy button").Visible = true
		end
	
end)