Simple script error that I can't fix

Greetings, I was working on a script, but I have encountered this error that I can’t fix, and if I look at it for another second my brain will explode, have fun!


Screen Shot 2023-05-07 at 4.04.36 PM

Copy the code here
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClickDetector = script.Parent.ClickDetector
local Sphere = ReplicatedStorage.CopyingFolder.Sphere

local 

ClickDetector.MouseClick:Connect(function(SphereClone)
	
	SphereClone = Sphere:Clone()

	SphereClone.Parent =  workspace.CustomMech
	SphereClone.Size = Vector3.new(1, 1, 1)
	SphereClone.Position = workspace.CustomMech.Spawn

	
	
end)

Just get rid of the work local

1 Like

It’s because there’s a local that doesn’t have anything after it, delete it:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClickDetector = script.Parent.ClickDetector
local Sphere = ReplicatedStorage.CopyingFolder.Sphere 

ClickDetector.MouseClick:Connect(function(SphereClone)
	
	SphereClone = Sphere:Clone()

	SphereClone.Parent =  workspace.CustomMech
	SphereClone.Size = Vector3.new(1, 1, 1)
	SphereClone.Position = workspace.CustomMech.Spawn

	
	
end)

I’m so stupid @moscowGOD and @Dede_4242, thanks!

hover over the red/orange underlines and it’ll tell you what’s wrong

It’ll throw the same error as the one OP already has

I was assuming OP didn’t know when there’s a red underline that means there’s something wrong with in the script (because it was tested ingame)

just letting them know for the future since this was already solved

Yeah I got it, but the thing is that going to the red line would’ve said the same thing :sweat_smile:

right and since you see it in the script you wouldn’t have to test it ingame
which is what OP did
you could save time by reading the error in the script

1 Like