(Sorry if the title didn’t explain much.)
I’m trying to build a selection system. But when I add this line of code: if game.ReplicatedStorage.Input == “Built” then
it errors.
Here’s the error:
Players.exp_lol123.PlayerGui.MainHandler.BuildMain.StarterItemBody.Build.StarterSelect:17: Expected <eof>, got 'end'
I’ve added an end and it still doesn’t work.
Code:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local target = mouse.Target
print(“Here”)
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Delete.MouseButton1Click:Connect(function()
if game.ReplicatedStorage.Input == "Built" then
if mouse.Target == workspace.FrontRoof then
local SB = Instance.new("SelectionBox")
SB.Adornee = workspace.FrontRoof
SB.Parent = workspace.FrontRoof
end
end
end)
end)
end)
(Ignore the rest of the code)
1 Like
You have an extra end)
though
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local target = mouse.Target
print("Here")
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Delete.MouseButton1Click:Connect(function()
if game.ReplicatedStorage.Input == "Built" then
if mouse.Target == workspace.FrontRoof then
local SB = Instance.new("SelectionBox")
SB.Adornee = workspace.FrontRoof
SB.Parent = workspace.FrontRoof
end
end
end)
end)
What do you mean extra end)? Don’t see anything.
Shall I put this in bug reports…
Think of it like this, we first set up 2 individual numbers which would hold our functions/conditional checks, and ends:
- For our functions/conditional checks, we have a total of 4
- For our ends, we have a total of 5
If you subtract them both…
4 - 5 = -1
It’s not equal to zero, which would result as a syntax error cause you added an additional end inside your script
1 Like
Thanks! Now every time I have an end error, I can look at this!
Just for reference, <eof> means end of file. The script was expecting the end of the script but instead of where the script should be ending there’s an end (closes a scope opened by function/if/do/etc). When you get this error it means that you have an extra end that you don’t need. Always why it’s a good idea to pay attention to your indenting, helps you see these issues better.