Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

"Unknown global" warning when trying to pass parameter to FireAllClients()?

So I made 2 scripts for a button, the 1st one is a serverscript and changes the color of a part, and then the serverscript fires a RemoteEvent for all client(it should show GUI to clients).

The only problem is, when I try to pass a parameter to the FireAllClients() function, I get a warning saying "unknown global"

here's the serverscript:

button.ClickDetector.MouseClick:Connect(function()
	
	if not wasItClick then
		
		wasItClick = true
		
		local fire = Instance.new("Fire")
	
		fire.Color = workspace.TweenButton.Part.Color
	
		fire.Parent = workspace.TweenButton.Part

		game.ReplicatedStorage.MakeGUiAppear:FireAllClients(parameter)
		
		wait(2)

		
		wasItClick = false
		
		
	end
	
end)

localscript:

local frame = script.Parent

game.ReplicatedStorage.MakeGUiAppear.OnClientEvent:Connect(function()
	
	
	frame.Visible = true
	
	wait(2)
	
	frame.Visible = false
	
	
	
	
end)

I'm new to scripting, and I've never really done anything involving RemoteEvents before, so if anybody could point out the errors in my code, I would really appreciate it

3 comments

0

(parameter) has no global value and is not a local variable. You also forgot to add the player when firing all clients. Check my response for more information.

0

*Nevermind the Second Sentence about adding player

0

Can you give us the full code?

1 answer

✓ Accepted answer

Hey Mathenotics!

You added "parameter" which is not a variable/global value. So the best thing to do is to remove parameter.

button.ClickDetector.MouseClick:Connect(function()

    if not wasItClick then

        wasItClick = true

        local fire = Instance.new("Fire")

        fire.Color = workspace.TweenButton.Part.Color

        fire.Parent = workspace.TweenButton.Part

        game.ReplicatedStorage.MakeGUiAppear:FireAllClients()

        wait(2)


        wasItClick = false


    end

end)

*Thanks to Mayk728 for pointing out an error in my answer

The localside of the script seems to be fine.

Hope I helped, LennyPlayzYT

4 comments

0

incorrect. when firing all clients, you are not supposed to put a single player argument since it's already sending a signal to all the clients.

0

you only put the player argument when you're firing to a single client ":FireClient(player)"

0

Oh. In that case, there should be no arguments. Correct?

0

mhm

This discussion is preserved as it was. New answers, comments, and votes are closed.