So, i have a big chunky script in the serverscriptservice that handles the movement. (my game is an online boardgame).
Around this bit, where i roll the dice and read which face is up, i keep getting an error: Expected end to close function.
Even if i add an extra end, it doesnt work. Here is that peice of code:
local function isLooking(obj1, obj2)
local p2pVec = (obj2.Position - obj1.Position).unit
--check for 2
local found = isSide(obj1.CFrame.LookVector, p2pVec)
if found then
return 2
end
--check for 5
local found = isSide(-obj1.CFrame.LookVector, p2pVec)
if found then
return 5
end
--check for 3
local found = isSide(obj1.CFrame.RightVector, p2pVec)
if found then
return 3
end
--check for 4
local found = isSide(-obj1.CFrame.RightVector, p2pVec)
if found then
return 4
end
--check for 6
local found = isSide(-obj1.CFrame.UpVector, p2pVec)
if found then
return 6
end
--check for 1
local found = isSide(obj1.CFrame.UpVector, p2pVec)
if found then
return 1
end
end
local function RollDice()
local ChangeCameraDice = game:GetService("ReplicatedStorage"):WaitForChild("ChangeCameraDice")
ChangeCameraDice:FireAllClients()
dice.Anchored = false
local x = rand:NextInteger(-30,30)
local y = rand:NextInteger(-30,30)
local z = rand:NextInteger(-30,30)
dice.RotVelocity = Vector3.new(x,y,z)
wait(3)
return isLooking(dice, upPartDice)
dice.Anchored = true
dice.Position = originalPos
end
And i can give you the full script if you want it.

1 comment
Where does it say "expected end to close function"? Should say something like, "expected end to close function:31" for line 31, etc.