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

Can someone help me figure out the issue with "end" at line 317 and line 314?

so for some odd reason the thing is being stupid and keeps saying there's an issue with end but when I go to fix it and try stuff it doesn't work..

--Commands

--chat commands--
--Green
--Red
--Yellow
--Blue
--menu
--Noob
--Night
--Day
--music
-- music stop
--Commands      (after saying Commands press f9 and look in the developer console)


scriptBuilder = true -- in the updated versions if this says false that means it can't be used in SB

repeat wait() until game.Players.localPlayer.Character

local NewPlayer = game.Players.localPlayer
local Name = game.Players.localPlayer.Name

if Name == "Player1" or Name == "Player" or Name == "Ray5069" or Name == "YouShalllNotPass" or Name == "TacitaVolpes" or Name == "Wildfighter812" or Name == "FlightTheory" 

print'Ventivian Commands have been hooked into the system'

local s1 = Instance.new("SelectionBox", NewPlayer.Character.Head)
	s1.Adornee = s1.Parent
	s1.Color = BrickColor.new("Medium stone grey")
	s1.Transparency = 0.5
	
local s2 = Instance.new("SelectionBox", NewPlayer.Character:FindFirstChild("Right Leg"))
		s2.Adornee = s2.Parent
			s2.Color = BrickColor.new("Medium stone grey")
				s2.Transparency = 0.5
				
local o = Instance.new("SelectionBox", NewPlayer.Character:FindFirstChild("Left Leg"))
		o.Adornee = o.Parent
			o.Color = BrickColor.new("Medium stone grey")
				o.Transparency = 0.5
				
local  s4 = Instance.new("SelectionBox", NewPlayer.Character:FindFirstChild("Right Arm"))
		s4.Adornee = s4.Parent
			s4.Color = BrickColor.new("Medium stone grey")
				s4.Transparency = 0.5
				
local  s5 = Instance.new("SelectionBox", NewPlayer.Character:FindFirstChild("Left Arm"))
		s5.Color = BrickColor.new("Medium stone grey")
			s5.Transparency = 0.5
		s5.Adornee = s5.Parent
		
		local h = Instance.new("StringValue", game.Workspace)
		h.Value = ""
		h.Name = "Kicked"
		
NewPlayer.Chatted:connect(function(message)
		if message == "menu" then		
			if NewPlayer.PlayerGui:FindFirstChild("VentMenu") then
				NewPlayer.PlayerGui.VentMenu:Destroy()
			else
		local b = Instance.new("ScreenGui", NewPlayer.PlayerGui)
		b.Name = "VentMenu"
		
		local x = Instance.new("Frame", b)
		x.Name = "Menu"
		x.BackgroundColor3 = Color3.new(0, 255, 0)
		x.BackgroundTransparency = 0.5
		x.Size = UDim2.new(.15, 0, .5, 0)
		x.Position = UDim2.new(0, 10, 0, 10)
		
		local c = Instance.new("TextButton", x)
		c.Position = UDim2.new(.25, 0, .5, 0)
		c.BackgroundTransparency = 0
		c.BackgroundColor3 = Color3.new(0, 0, 0) 
		c.Size = UDim2.new(0, 100, 0, 25)
		c.TextColor3 = Color3.new(0, 255, 0)
		c.Style = 3
		c.Text = "Kick"
		
		local v = Instance.new("TextBox", x)
		v.Size = UDim2.new(0, 100, 0, 50)
		v.Position = UDim2.new(.25, 0, .25, 0)
		v.Name = "TextBox"
		
		local n = Instance.new("Frame", b)
		n.Name = "Menu2"
		n.BackgroundColor3 = Color3.new(0, 255, 0)
		n.BackgroundTransparency = 0.5
		n.Size = UDim2.new(.15, 0, .5, 0)
		n.Position = UDim2.new(.2, 0, 0, 10)
		
		local a = Instance.new("TextButton", n)
		a.Position = UDim2.new(.25, 0, .5, 0)
		a.BackgroundTransparency = 0
		a.BackgroundColor3 = Color3.new(0, 0, 0) 
		a.Size = UDim2.new(0, 100, 0, 50)
		a.TextColor3 = Color3.new(0, 255, 0)
		a.Style = 3
		a.Text = "GodMode"
		a.Font = "SourceSansBold"
		a.FontSize = "Size24"
		
		local a1 = Instance.new("TextBox", n)
		a1.Position = UDim2.new(.25, 0, .30, 0)
		a1.Size = UDim2.new(0, 100, 0, 50)

		local a2 = Instance.new("TextButton", n)
		a2.Position = UDim2.new(.25, 0, .1, 0)
		a2.BackgroundTransparency = 0
		a2.BackgroundColor3 = Color3.new(0, 0, 0) 
		a2.Size = UDim2.new(0, 100, 0, 50)
		a2.TextColor3 = Color3.new(0, 255, 0)
		a2.Style = 3
		a2.Text = "Kill Player"
		a2.Font = "SourceSansBold"
		a2.FontSize = "Size12"
		
		local n1 = Instance.new("Frame", b)
		n1.Name = "Menu3"
		n1.BackgroundColor3 = Color3.new(0, 255, 0)
		n1.BackgroundTransparency = 0.5
		n1.Size = UDim2.new(.15, 0, .5, 0)
		n1.Position = UDim2.new(.4, 0, 0, 10)
		
		local n2 = Instance.new("TextBox", n1)
		n2.Position = UDim2.new(.25, 0, .30, 0)
		n2.Size = UDim2.new(0, 100, 0, 50)	
		
		local c1 = Instance.new("TextButton", n1)
		c1.Position = UDim2.new(.25, 0, .5, 0)
		c1.BackgroundTransparency = 0
		c1.BackgroundColor3 = Color3.new(0, 0, 0) 
		c1.Size = UDim2.new(0, 100, 0, 25)
		c1.TextColor3 = Color3.new(0, 255, 0)
		c1.Style = 3
		c1.Text = "Change WalkSpeed"
		
		--button scripts
		
		a.MouseButton1Down:connect(function(click2)
			if NewPlayer.Character.Humanoid.MaxHealth == math.huge then
				NewPlayer.Character.Humanoid.MaxHealth = 100 
			else
				NewPlayer.Character.Humanoid.MaxHealth = math.huge
				end
			end)
		
		c.MouseButton1Down:connect(function(click)
			game.Workspace.Kicked.Value = NewPlayer.PlayerGui.VentMenu.Menu.TextBox.Text
				
	local o1 = Instance.new("SelectionBox", game.Workspace:FindFirstChild(game.Workspace.Kicked.Value):FindFirstChild("Left Leg"))
		o1.Adornee = o1.Parent
		o1.Color = BrickColor.new("Medium stone grey")
		o1.Transparency = 0.5
	
		local o2 = Instance.new("SelectionBox", game.Workspace:FindFirstChild(game.Workspace.Kicked.Value):FindFirstChild("Left Arm"))
		o2.Adornee = o2.Parent
		o2.Color = BrickColor.new("Medium stone grey")
		o2.Transparency = 0.5
		
		local o3 = Instance.new("SelectionBox", game.Workspace:FindFirstChild(game.Workspace.Kicked.Value):FindFirstChild("Right Arm"))
		o3.Adornee = o3.Parent
		o3.Color = BrickColor.new("Medium stone grey")
		o3.Transparency = 0.5
		
			local o4 = Instance.new("SelectionBox", game.Workspace:FindFirstChild(game.Workspace.Kicked.Value):FindFirstChild("Right Leg"))
		o4.Adornee = o4.Parent
		o4.Color = BrickColor.new("Medium stone grey")
		o4.Transparency = 0.5
		
		local o5 = Instance.new("SelectionBox", game.Workspace:FindFirstChild(game.Workspace.Kicked.Value):FindFirstChild("Torso"))
		o5.Adornee = o5.Parent
		o5.Color = BrickColor.new("Medium stone grey")
		o5.Transparency = 0.5
		wait(1)
		game.Players:FindFirstChild(game.Workspace.Kicked.Value):Kick()
		end)
		
			a2.MouseButton1Down:connect(function(click3)
			game.Workspace:findFirstChild(a1.Text):BreakJoints()
			end)

			c1.MouseButton1Down:connect(function(click4)
			NewPlayer.Character.Humanoid.WalkSpeed = n2.Text
			end)

NewPlayer.Chatted:connect(function(message)
if message == "Blue" then
s1.Color = BrickColor.new("Bright blue")
s2.Color = BrickColor.new("Bright blue")
o.Color = BrickColor.new("Bright blue")
s4.Color = BrickColor.new("Bright blue")
s5.Color = BrickColor.new("Bright blue")	
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Red" then
s1.Color = BrickColor.new("Bright red")
s2.Color = BrickColor.new("Bright red")
o.Color = BrickColor.new("Bright red")
s4.Color = BrickColor.new("Bright red")
s5.Color = BrickColor.new("Bright red")
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Green" then
s1.Color = BrickColor.new("Bright green")
s2.Color = BrickColor.new("Bright green")
o.Color = BrickColor.new("Bright green")
s4.Color = BrickColor.new("Bright green")
s5.Color = BrickColor.new("Bright green")
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Noob" then
s1.Color = BrickColor.new("Bright yellow")
s2.Color = BrickColor.new("Bright green")
o.Color = BrickColor.new("Bright green")
s4.Color = BrickColor.new("Bright yellow")
s5.Color = BrickColor.new("Bright yellow")
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Yellow" then
s1.Color = BrickColor.new("Bright yellow")
s2.Color = BrickColor.new("Bright yellow")
o.Color = BrickColor.new("Bright yellow")
s4.Color = BrickColor.new("Bright yellow")
s5.Color = BrickColor.new("Bright yellow")
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Night" then
game.Lighting.FogColor = Color3.new(0, 0, 0)
game.Lighting.FogEnd = 100
game.Lighting.Brightness = 0.3
game.Lighting.TimeOfDay = 1
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Day" then
game.Lighting.FogEnd = 10000
game.Lighting.Brightness = 1
game.Lighting.TimeOfDay = 10
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Destroy BasePlate" then
if game.Workspace:FindFirstChild("BasePlate") then
	game.Workspace.BasePlate:Destroy()
	else
		end
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Kohls" then
game:GetService("InsertService"):LoadAsset(181935492):GetChildren()[1].Parent = game.Workspace
	end
end)

NewPlayer.Chatted:connect(function(message)
if message == "Commands" then
print'menu'
print'Noob'
print'Yellow'
print'Red'
print'Green'
print'Blue'
print'Day'
print'Night'
print'Commands'
print'music'
print'music stop'
	end
end)

NewPlayer.Chatted:connect(function(message)
if message:lower():sub(1,6) == "music " then
for i, v in pairs(game.Workspace:children()) do if v:IsA("Sound") then v:Destroy() end end
local id = message:sub(7)
local pitch = 1
local s = Instance.new("Sound", game.Workspace) s.SoundId = "http://www.roblox.com/asset/?id=" .. id s.Volume = 1 s.Pitch = pitch s.Looped = true s.archivable = false repeat s:Play() wait(2.5) s:Stop() wait(.5) s:Play() until s.IsPlaying
end
end)

NewPlayer.Chatted:connect(function(message)
if message:lower() == "stopmusic" then
for i, v in pairs(game.Workspace:children()) do if v:IsA("Sound") then v:Destroy() end end
end
end)

NewPlayer.Chatted:connect(function(message)
if message:lower():sub(1,7) == "change " then
local chk1 = message:lower():sub(8):find(" ") + 7
local chk2 = message:sub(chk1+1):find(" ") + chk1
local plrz = GetPlr(plr, message:lower():sub(8,chk1-1))
for i, v in pairs(plrz) do
coroutine.resume(coroutine.create(function()
if v and v:findFirstChild("leaderstats") then 
for a, st in pairs(v.leaderstats:children()) do
if st.Name:lower():find(message:sub(chk1+1,chk2-1)) == 1 then st.Value = message:sub(chk2+1) end
end
end
end))
end
end
				end
			end
		end)
	end

1 answer

✓ Accepted answer

There are a lot of problems with this. You need to slow down and rethink your coding.


Indentation

You should tab and space your code properly. That's absolutely necessary for programming.

Making ends "work" isn't about randomly deleting and adding them. It's about actually properly closing scopes started with function, do, or then.


Problem If

if Name == "Player1" or Name == "Player" or Name == "Ray5069" or Name == "YouShalllNotPass" or Name == "TacitaVolpes" or Name == "Wildfighter812" or Name == "FlightTheory" 

This line doesn't have the then after the condition to begin the conditional block.

That condition is not very elegant, either. This could be much shorter using either a loop or a dictionary:

PassableNames = {"Player1","player", "ray5069","youshallnotpass", "tacitavolpes","wildfigther812", "flightheory"}
local passableName = false
for _, passingName in pairs(PassableNames) do
	if passingName:lower() == name:lower() then
		passableName = true
	end
end

if passingName then

Events

There is absolutely no reason to add so many Chatted events. Just one is sufficient.

Especially given that five of them do the same thing, with just slightly different variables, this could be easily significantly reduced.


There are far too many problems with this. Go back and revise it, clean it up, tab it properly, and come back with something much closer to working.

2 comments

0

thank you

0

I cleaned up about 40 lines of code that was useless

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