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

how do i fix the expected ')' error?

local Arrow = script.Parent
local Click = Arrow:WaitForChild("Click")

Click.MouseClick:Connect(function(player)

	local Backpack = player:FindFirstChild("Backpack")
	if Backpack then
		local Stands = game:GetService("ServerStorage"):WaitForChild("Stands")

		local randomStand = math.random(1,3)
		if randomStand == 1 then
			--Give Stand1
			if Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") then
				local prevStand = workspace:FindFirstChild(player.Name.." Stand")
				local prev = Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Pickle") or Backpack:FindFirstChild("RR")
				prevStand:Destroy()
				prev:Destroy()

				local Stand = Stands:FindFirstChild("Mist"):Clone()
				Stand.Parent = Backpack
			else
				local Stand = Stands:FindFirstChild("Mist"):Clone()
				Stand.Parent = Backpack
			end

		elseif randomStand == 2 then
			--Give Stand2
			if Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") then
				local prevStand = workspace:FindFirstChild(player.Name.." Stand")
				local prev = Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR")
				prevStand:Destroy()
				prev:Destroy()

				local Stand = Stands:FindFirstChild("RR"):Clone()
				Stand.Parent = Backpack
			else
				local Stand = Stands:FindFirstChild("RR"):Clone()
				Stand.Parent = Backpack
			end

		elseif randomStand == 3 then
			--Give Stand3
			if Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") or Backpack:FindFirstChild("Pickle") then
				local prevStand = workspace:FindFirstChild(player.Name.." Stand")
				local prev = Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") or Backpack:FindFirstChild("Pickle")
				prevStand:Destroy()
				prev:Destroy()

				local Stand = Stands:FindFirstChild("Pickle"):Clone()
				Stand.Parent = Backpack
			else
				local Stand = Stands:FindFirstChild("Pickle"):Clone()
				Stand.Parent = Backpack
			end
		end
	end
end

Error:Workspace.GiveStand:58: Expected ')' (to close '(' at line 5), got Line 5

1 answer

✓ Accepted answer

Maybe add a ) after the last end? like:

			end
		end
	end
end) -- here

The reason for this is that: the function is enclosed in parentheses of the :Connect() signal. That's why we need to add an extra ) at the end.

1 comment

0

oh ok

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