I'm writing a script and I can't seem to make this error go away at elseif.
event.OnServerEvent:connect(function() if sp2.Opened.Value == false then for _,v in pairs(sp:GetChildren()) do sp:SetPrimaryCFrame(sp:GetPrimaryPartCFrame() * CFrame.new(Settings.Speed * Settings.Direction,0,0)) sp.Opened.Value = true game:GetService('RunService').Stepped:wait() elseif sp2.Opened == true then -- for _,v in pairs(sp:GetPrimaryPartCFrame() * CFrame.new(Settings.Speed * Settings.Direction,0,0)) sp.Opened.Value = false game:GetService('RunService').Stepped:wait() end end end)
In the output logs:
19:39:15.641 - Workspace.Door.clicky.InteractionDistribution:50: 'end' expected (to close 'for' at line 46) near 'elseif'
The answer is simple. You're missing an end to close off the for loop at line 03. Here's a fixed version of your code:
event.OnServerEvent:connect(function() if sp2.Opened.Value == false then for _,v in pairs(sp:GetChildren()) do sp:SetPrimaryCFrame(sp:GetPrimaryPartCFrame() * CFrame.new(Settings.Speed * Settings.Direction,0,0)) sp.Opened.Value = true game:GetService('RunService').Stepped:wait() end elseif sp2.Opened == true then -- for _,v in pairs(sp:GetPrimaryPartCFrame() * CFrame.new(Settings.Speed * Settings.Direction,0,0)) sp.Opened.Value = false game:GetService('RunService').Stepped:wait() end end end)