I just added some more code to a script and it is throwing the following code:
[Script:81: Expected ‘)’ (to close ‘(’ at line 41), got ‘end’]
I’m confused as how to tell what I need to fix. Here is the code:
local vehiclefunc = game.ReplicatedStorage.Vehicle
Cloned2 = game.ReplicatedStorage["Vehicle"]:clone()
game.ServerStorage["Vehicle"]:remove()
local OriginColor = script.Parent.BrickColor
local JustRegened = false
local RegenWait = 5
Current = nil
local Allowance = 0 -- 0 = All, 1 = Group, 2 = GamePass.
local GroupId = 0
local GroupRank = 0
local GamePassId = 382612574
function CheckAllowed(plr)
local ToReturn = false
if Allowance == 0 then
ToReturn = true
elseif Allowance == 1 then
if plr:IsInGroup(GroupId) and plr:GetRankInGroup(GroupId) >= GroupRank then
ToReturn = true
end
elseif Allowance == 2 then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr, GamePassId) == true then
ToReturn = true
end
end
return ToReturn
end
function Click(plr)
if JustRegened == false then
JustRegened = true
script.Parent.BrickColor = BrickColor.new("Really black")
coroutine.resume(coroutine.create(function()
if plr then
if plr.Character then
if CheckAllowed(plr) == true then
coroutine.resume(coroutine.create(function()
if plr.Character:findFirstChild("SpeederVehicle") ~= nil then
plr.Character["SpeederVehicle"]:remove()
end
end))
for i, v in pairs(game.Players:GetChildren()) do
coroutine.resume(coroutine.create(function()
if v then
if v.Character then
if v.Character:findFirstChild("SpeederVehicle") then
if (v.Character["SpeederVehicle"]["Speeder"]["Engine"].Position - script.Parent.Position).magnitude <= 10 then
v.Character["SpeederVehicle"]:remove()
end
end
end
end
end))
wait(0.01)
end
local NewCloneModel = Instance.new("Model", plr.Character)
NewCloneModel.Name = "SpeederVehicle"
local NewClone = Cloned:clone()
--NewClone.Parent = plr.Character
NewClone.Parent = NewCloneModel
end
else
local NewCloneValue = Instance.new("BoolValue", plr.Character)
NewCloneValue.Name = "Vehicle"
local NewClone2 = Cloned2:clone()
NewClone2.Parent = NewCloneModel
end
if Allowance == 2 then
game:GetService("MarketplaceService"):PromptPurchase(plr, GamePassId)
end
end
end
end)
wait(RegenWait)
JustRegened = false
script.Parent.BrickColor = OriginColor
end
end
script.Parent["ClickDetector"].MouseClick:connect(Click)
I am unsure of what to do, because the error is on line 81 but it says it’s trying to end the ‘(’ but line 41 ends with
coroutine.resume(coroutine.create(function()