Hello, I have server scripts in workspace. And inside that are remote events.

This is inside the server script.

k = false
game.ReplicatedStorage.CCEvent.OnServerEvent:connect(function(player,message)
	if message == "Click" then
		if k == false then
			k = true
			
		player.PlayerGui.Menu.Main1.Change.Stuff.Click.Scriptz.scout:Play()
	for i = 1,10 do
		wait()
		player.PlayerGui.Menu.Main1.New.BackgroundTransparency = player.PlayerGui.Menu.Main1.New.BackgroundTransparency-.1
	end
	wait(1.5)
		
	player.PlayerGui.Menu.Main1.Change.Bg:Stop()
	player.PlayerGui.Menu.Main1.Change.Visible = false
	wait(2)

	
    
	
	wait(5)
		end



	end	
	if message == "enter" then
		player.PlayerGui.Menu.Main1.Change.Stuff.Click.Script.hover:Play()
	player.PlayerGui.Menu.Main1.Change.Stuff.Click.TextSize = 42
	end
	if message == "leave" then
	player.PlayerGui.Menu.Main1.Change.Stuff.Click.TextSize = 38
	end
end)

Then in the players backpack to call that event is this:

	wait(8)
	k = false
game.Players.LocalPlayer.PlayerGui.Menu.Main1.Change.Stuff.Click.MouseButton1Click:connect(function()
	if k == false then
		k = true
	game.ReplicatedStorage.CCEvent:FireServer("Click")
	wait(90)
	k = false
	end
end)

But once the player resets. It stops working. Why?

2 comments

0

What do you mean by "It stops working?" Is the event on the server no longer fired? Does an error appear? Is the localscript placed in the StarterPack? (On a side note, have you considered putting it into StarterPlayer?

0

You're using two arguments in the first function, are you sure it's passing the player variable?