Okay this is getting annoying lol.

I have a client side script and a server side script. Along with one local script inside a GUI button.

So everything was working before I cut out all of the weapon and armor and health code inside the scripts into my new place where the actual battling is taking place.

So now the only stuff in the scripts are the main menu gui and player data stuff.

For some reason when I did that, my remote events stopped firing to the server. Not sure why! It keeps happening and I keep fixing it with some little thing that changes each time. Not sure if it's a symptom of a bigger problem or what but it's really getting on my nerves cause nothing comes out in the output.

Here is the local script inside my playerCharacterScripts folder: I fire to the server on line 94

-- Sets up Player Components
	local player = game.Players.LocalPlayer
	local Character = player.Character
	local Humanoid = Character:WaitForChild("Humanoid")

-- Services
	local TweenService = game:GetService("TweenService")
	local RunService = game:GetService("RunService")
	local CoreGui = game:GetService("StarterGui")

-- Remote Events
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local PlayerData = ReplicatedStorage:WaitForChild("PlayerData")
	
--------------------------------------------------------------------------------------------------------
-- Main Menu GUI
--------------------------------------------------------------------------------------------------------

	-- Main Menu	
		local MainMenu = player.PlayerGui.MainMenu.BackGround
		-- Tabs
			local TopBar = MainMenu.TopBar
			local CustomLoadoutsTab = TopBar.CustomLoadouts
			local MainMenuTab = TopBar.MainMenu
			local CharacterCustomizeTab = TopBar.CharacterCustomize
			
	-- Queue Screen
		local QueueScreen = MainMenu.QueueScreen
		local PresentTab = QueueScreen
		
		-- On Tab Switches pages
			MainMenuTab.MouseButton1Click:Connect(function()
				local Temp = PresentTab
				PresentTab = QueueScreen
				Temp.Visible = false
				PresentTab.Visible = true
			end)
			
		-- Game Mode Selection
			local GameModeButton = QueueScreen.GameModeButton
			local Searching = QueueScreen.Searching
			local Cancel = Searching.Cancel
			
			
			local function StartSearch()
				Searching.Visible = true
				-- Matchmaking blah blah blah
				
				-- Cancel MatchMaking
					Cancel.MouseButton1Click:Connect(function()
						Searching.Visible = false
					end)
			end
			
			GameModeButton.MouseButton1Click:Connect(function()
				StartSearch()
			end)
		-- Social/ Add Friend to party
			local Social = QueueScreen.Social
			local AddFriendToParty = Social.AddFriendToParty.TextButton
			local ProfilePictureTemplate = ReplicatedStorage.GuiAssets.Social:WaitForChild("FriendProfilePicture")
			
		-- Profile Customization
			local PlayerProfile = QueueScreen.PlayerProfile
			
			-- Profile Picture Selection
				local ProfilePicture = PlayerProfile.ProfilePicture
				
			-- Banner Selection
				local Banner = PlayerProfile.Banner
		
	-- Custom Loadout Screen
		local CustomLoadout = MainMenu.CustomLoadout
		
		-- Switch Pages on Click
			CustomLoadoutsTab.MouseButton1Click:Connect(function()
					local Temp = PresentTab
					PresentTab = CustomLoadout
					Temp.Visible = false
					PresentTab.Visible = true
			end)
		
		-- Class Selection
			local ClassSelection = CustomLoadout.ClassSelection
			local AddCustomClass = ClassSelection.AddCustomClass
			local WeaponLoadoutImage = CustomLoadout.WeaponLoadoutImage
			local WeaponSlotTemplate = ReplicatedStorage.GuiAssets.CustomClass:WaitForChild("WeaponSlotButton")
			local NewCustomClass = PlayerData:WaitForChild("NewCustomClass")
			local Disconnect

			-- Add New Class
				AddCustomClass.MouseButton1Click:Connect(function()
					Disconnect = false
					NewCustomClass:FireServer()
					
					local NewClassEvent = NewCustomClass.OnClientEvent:Connect(function(CustomClassNumber)
						local NewClassButton = WeaponSlotTemplate:Clone()
						NewClassButton.Parent = ClassSelection
						NewClassButton.Text = "Custom Class "..CustomClassNumber
						NewClassButton.Name = "CustomClass"..CustomClassNumber
						Disconnect = true
					end)
					
					repeat wait() until Disconnect == true
					if Disconnect == true then
						NewClassEvent:Disconnect()
					end
				end)
				
			-- Weapon Loadout
				local WeaponLoadout = CustomLoadout.WeaponLoadout
				local PrimaryWeapon = WeaponLoadout.Weapon
				local Secondary = WeaponLoadout.Secondary
				local Tactical = WeaponLoadout.Tactical
				local Lethal = WeaponLoadout.Lethal
				local Perk = WeaponLoadout.Perk
				local ClassName = WeaponLoadout.ClassName
				local BackButtonCustomClasses = WeaponLoadout.BackButton
				
				-- Back Button
				BackButtonCustomClasses.MouseButton1Down:Connect(function()
					WeaponLoadout.Visible = false
					ClassSelection.Visible = true
				end)
				
				-- Weapon Attachment Screen
					local WeaponAttachmentScreen = WeaponLoadout.WeaponAttachmentScreen
					local LevelBar = WeaponAttachmentScreen.LevelBar
					local LevelBarBackGround = WeaponAttachmentScreen.LevelBarBackground
					local WeaponLevel = WeaponAttachmentScreen.WeaponLevel
					local WeaponName = WeaponAttachmentScreen.WeaponName
					-- Load Weapon Attachment Buttons For the Specific weapon
					-- Maybe Have the weapon model somewhere else and have a 
					-- viewport so you can see the modifications.
--------------------------------------------------------------------------------------------------------
-- UseFull Client Functions	
--------------------------------------------------------------------------------------------------------
	
	-- Tweens Anything passed to it
		function TweenMyBar(Percentage, Item, FrameWidth)
			Item:TweenSize(UDim2.new(Percentage,0,FrameWidth,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, .5, true)
		end
--------------------------------------------------------------------------------------------------------
-- UseFull Client Functions	
--------------------------------------------------------------------------------------------------------
	
	-- Tweens Anything passed to it
		function TweenMyBar(Percentage, Item, FrameWidth)
			Item:TweenSize(UDim2.new(Percentage,0,FrameWidth,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, .5, true)
		end

Here is the Server Module Script inside ServerScriptService:

-- Replicated Storage
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local PlayerData = ReplicatedStorage:WaitForChild("PlayerData")
	
-- Services
	local ContextActionService = game:GetService("ContextActionService")
	local TweenService = game:GetService("TweenService")

	-- Tables
		local module = {}
		
		local CustomClass = {
			ClassName = nil,
			Primary = {},
			Secondary = {},
			Tactical = nil,
			Lethal = nil,
			Perk = nil,
		}

--------------------------------------------------------------------------------------------------------
-- Player Loads In
--------------------------------------------------------------------------------------------------------
		
	-- PlayerAdded 
		game.Players.PlayerAdded:Connect(function(player)
			module.AddPlayerData(player)
		end)
		
	-- Adds PlayerData To module
		function module.AddPlayerData(player)
			module[""..player.UserId] = {
				InGame = {
					ArmorAmount = 0,
					MaxHealthPerArmorSlot = 25,
					ArmorSlotsTaken = 0,
					Health = 100,
					MaxHealth = 100,
					MaxAmmo = 30,
					
					-- Holds the weapons table with all of the data.
					WeaponSlot1 = nil,
					WeaponSlot2 = nil,
				},
				
				CustomClasses = {
					CustomClassNumber = 0
				}
			}
		end
		
--------------------------------------------------------------------------------------------------------
-- Custom Loadouts/Custom Classes
--------------------------------------------------------------------------------------------------------
	-- Remote Events
		local NewCustomClass = PlayerData.NewCustomClass
		local CustomClassInfo = PlayerData.CustomClassInfo
		
		-- New Custom Class
		NewCustomClass.OnServerEvent:Connect(function(player)

			module[""..player.UserId].CustomClasses.CustomClassNumber = module[""..player.UserId].CustomClasses.CustomClassNumber + 1
			local CustomClassNumber = module[""..player.UserId].CustomClasses.CustomClassNumber
			CustomClass.Name = "CustomClass"..CustomClassNumber
			
			module[""..player.UserId].CustomClasses["CustomClass"..CustomClassNumber] = CustomClass
			NewCustomClass:FireClient(player, CustomClassNumber)
		end)
		
		CustomClassInfo.OnServerEvent:Connect(function(player, CustomClassName)
			local ClassTable = module[""..player.UserId].CustomClasses[""..CustomClassName]
			CustomClassInfo:FireClient(player, ClassTable)
		end)	

return module

Here is the random local script inside my GUI button in replicated storage that I clone:

local player = game.Players.LocalPlayer

local CustomClass = script.Parent
local CustomClassInfo = game:GetService("ReplicatedStorage").PlayerData:WaitForChild("CustomClassInfo")

CustomClass.MouseButton1Click:Connect(function()
	player.PlayerGui.MainMenu.BackGround.CustomLoadout.ClassSelection.Visible = false
	player.PlayerGui.MainMenu.BackGround.CustomLoadout.WeaponLoadout.Visible = true
	-- Fetch Custom Class Information
	CustomClassInfo:FireServer(CustomClass.Name)
	
	local CustomClassDisconnect = CustomClassInfo.OnClientEvent:Connect(function(ClassTable)

	end)
	CustomClassDisconnect:Disconnect()
end)

That's literally all of the scripts in the place so if there's a problem it's in there lol.

SOLUTION: Since I only had one server script which was a module, it was not being read since nothing required it. So I made a script in serverscriptservice and required it and called one of it's functions when a player spawned in.

2 comments

0

Just as an extra thing to say: The button events work and connect when I press them. The only problems are the events aren’t firing.

0

Okay now I'm really confused.. So on the other place where I moved all of my weapon scripts and local scripts had the same problem where the remote events weren't firing. However when I put something in workspace that fired an event everything started working again. Is this a time thing for the server? I'm not sure why putting something in workspace that also fires to the server would work.