Admin Command Not Working

For this section of the code can you change it to:

commands.m = function(sender, args)
	
	for index,arg in pairs(args) do
		print(index,arg)
	end
	local message = args[1]
	
	if message then
		print("Message Found")
		ClientCommand:FireAllClients(message)
		print("Remote Event Fired")
	end
end

I just want to see if the arguments were passed correctly. So tell me the outputs.

1 Like

Ok so it printed this but no gui popped up:
image

I said :m e :grinning_face_with_smiling_eyes:

So it printed ā€œeā€ :grinning_face_with_smiling_eyes:

Tell me what is outputted for this client script:

print("Client Script Running")
local CommandsModule = require(script.Parent.CommandsModule)
local ClientCommand = script.Parent:WaitForChild("ClientCommand")
local player = game.Players.LocalPlayer
print("Loaded Variables")

ClientCommand.OnClientEvent:Connect(function(msg)
	print("Remote Event Fired To The Client")
	CommandsModule.MessageCommand(player, msg)
end)

13:26:13.662 Found Function - Server - Script:59
13:26:13.663 Running Function - Server - Script:66
13:26:13.663 table: 0xb6dfc0774ece2947 - Server - Script:67
13:26:13.663 1 e - Server - Script:34
13:26:13.663 Message Found - Server - Script:39
13:26:13.663 Remote Event Fired - Server - Script:41

Okay I just found something online. If your local script is located in the workspace and not part of your character it would not work. So can I ask where your model is located?

Workspace because I want it to run inside one model

Well apparently you couldn’t make it work like that. Just move the module and remote event to ReplicatedStorage, the server script to ServerScriptService, and your client script to StarterPlayerScripts under StarterPlayer. Then change up your directories. I think it would work.

well no because my friend made it work with a disabled local script :frowning:

Watch :grinning_face_with_smiling_eyes:

image
:grinning_face_with_smiling_eyes:

His LocalScriptExecution is disabled watch Ill test

I cannot do it i am not admin but yeah it is wierd:

He executes code from a value and makes it call a function to call message command

I mean your friend’s code might be cloning the local script and putting it inside the player’s PlayerScripts? I’m not sure, but the problem as of your code right now is just purely because local scripts can’t ā€œrunā€ inside workspace.

Oh well that sucks :frowning: :frowning: So my model cant stay in one model?

Would I put it in startergui or starterCharacterscripts?

I did it bro thank you I put the module in repstorage and event and my script in serverscriptservice and my localscript in startergui

Glad it helped, but sorry I couldn’t make it so that it’s all in one model.