Argument 1 missing or nil Client - Meditation:41

-- \\ Variables // --

local Randomzier = Random.new()

local Meditation = Instance.new("BoolValue")

local GUIS = script.Parent

local Circle = GUIS.MovingCircle

-- \\ Services/Service-Related Variables // --

local UIS = game:GetService("UserInputService")

local TW = game:GetService("TweenService")

local RSR = game:GetService("RunService")

local RS = game:GetService("ReplicatedStorage")

local Activated = game.ReplicatedStorage.Meditation

local Prg = game.ReplicatedStorage.Progressing

local MouseLoc = UIS:GetMouseLocation()
-- \\ Functions // --

GUIS.IgnoreGuiInset = true

Activated.OnClientEvent:Connect(function(Player, sequence)
	
Circle.MouseEnter:Connect(function()
		print("We working")
		if Meditation == true then return end
	while true do
		wait(1)
		script.Parent.MovingCircle:TweenPosition(
			UDim2.new(Randomzier:NextNumber(0, 0.962),0 ,Randomzier:NextNumber(0, 0.285),0),
			Enum.EasingDirection.Out,
			Enum.EasingStyle.Sine,
	--Line 41 is here?		2,
			false,
			nil

		)
			wait(1)
			Prg:FireServer(script.Parent.Name)
		end


end)
	
Circle.MouseLeave:Connect(function()

	GUIS.Enabled = false

end)
	
end)

New issue that popped up is that the input between client to client for the gui to work doesn’t seem to work at the moment.

I don’t quite understand what the problem is, how far does it get in what you want to accomplish before it stops working?

Sorry. It was the wrong script, but the issue changed now.

Now, the issue seems to be that Client to Client doesn’t work, but I need to interact with the gui somehow so how would I do something like this?

wait(1)

--\\ Variables-Players //--

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")

--\\ Animation-Variables //--

local Anim = Instance.new("Animation")

Anim.AnimationId = "rbxassetid://"

--\\ Services //--

local UIS = game:GetService("UserInputService")

local Event = game.ReplicatedStorage.Meditation

local gui = Player:WaitForChild("PlayerGui"):WaitForChild("TheMeditations") --wait for objects


--\\ Debouncing Variables //--

local Enabled = false

UIS.InputBegan:Connect(function(Input, Processed, IsTyping)
	if not IsTyping then
		if Processed then
			return
		end

		if Input.KeyCode == Enum.KeyCode.M then

			if Enabled == true then return end
			
			if Enabled == false and gui.Enabled == false then 
				Enabled = true
				gui.Enabled = true
				Event:FireClient(Input)
				 

			end



			

		end
	end
	
end)

Because of how events work, you can’t fire a local event from a local script.
All :FireClient events must be sent by the server.

You could work around this by sending an event to the server, processing it, then firing the Meditation event to the client that requested it.

In that case, you might wanna consider using a Remote Function. Remote Functions send a message to the server, then returns the result back to the client.

But what if the activation for the meditation event was through a local script?

What I want to do is make it a keybind that is usable to activate the meditation event, but I seem to be going through the issue of being unable to.

Remote functions can be fired from the client or the server, just like remote events. They fire to the server, then return the result back to the client, or vice versa. Here is an example where the client tells the server to make a part, then returns the part back to the client:

-- Server Script
local ReplicatedStorage = game.ReplicatedStorage
local RemoteFunction = ReplicatedStorage.Meditate -- The Remote function

local function MakePart(Player, Shape) -- Make sure to have the Player parameter
	local Part = Instance.new("Part", workspace)
	Part.Name = Player.Name .. "'s Part"
	Part.Size = Vector3.new(2,2,2)	-- All these properties will show on the server
	Part.Position = Vector3.new(0,5,0)
	Part.Shape = Shape
	return Part -- Make sure to return the object you want the client to edit!
end

RemoteFunction.OnServerInvoke = MakePart -- Whenever function is called, run the function
-- Local Script
wait(5)
local ReplicatedStorage = game.ReplicatedStorage
local RemoteFunction = ReplicatedStorage.Meditate -- The remote function
	
local NewPart = RemoteFunction:InvokeServer(Enum.PartType.Block) -- The parameters that the server will get
	
NewPart.Color = Color3.fromRGB(255,0,0)
NewPart.Size = Vector3.new(5,5,5)	-- These properties will only show on the client
NewPart.Shape = Enum.PartType.Cylinder

Here are the results of the code.
On the client:

On the server:

This is the main benefit of using a Remote Function. It runs a server-sided function, and then you can edit it further on the client, without others seeing those changes.

Hope this helps!

I still have a question. If I wanted to toggle it, such as something like this

M Toggles the Meditation script (Local Script) → The event happens on the server (Even though I don’t everyone to see the idk the work around) → ??? (Local Script) what is meant to happen at that point of the script?

Well, if you don’t want everyone to see it, then why should it run on the server? Also, what does this meditation thing do? Just wondering.

I plan to use it for a form of progression, each time the ball movement stops, it’ll update in leaderstats as exp, and continue moving around until the exp requirement is fulfilled.

Fixed. I decide to put my other part of the script in the gui script and it fixed itself.