Roblox lua is broken

wait(5)
local num = 4 -- Number of bots
local coef = -1



local wed=false
local invwed = false
local rotate = false
local rotate1 = 0
local zigzag = false
local sfl = false
script.Parent.Humanoid.AutoRotate=true
--local function chat(msg)
--	game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(msg,"All")
--end
game.Players.iSyriux.Character.Humanoid.Jumping:Connect(function()
	script.Parent.Humanoid.Jump=true
end)
game.Players.iSyriux.Chatted:Connect(function(msg)
	if string.lower(msg)==".wedge formation" then
		wed = true
		invwed = false
		zigzag = false
		sfl = false
	end
	if string.lower(msg)==".line formation" then
		wed = false
		zigzag = false
		sfl = false
	end
	if string.lower(msg)==".inverse wedge formation" then
		wed = true
		invwed = true
		zigzag = false
		sfl = false
	end
	if string.lower(msg)==".circle around me" then
		rotate = true
	end
	if string.lower(msg)==".stop circling around me" then
		rotate = false
	end
	if string.lower(msg)==".zigzag formation" then
		zigzag = true
		sfl = false
	end
	if string.lower(msg)==".sfl" then
		sfl = true
	end
	
end)
while wait() do
	local ars=0
	local er = math.random(1,100)
	if er==50 then
		--chat(".")
	end
	if wed==true then
		ars = -coef*2
	end
	if invwed==true then
		ars = -math.abs(ars)
	else
		ars = math.abs(ars)
	end
	if zigzag==true then
		if math.abs(coef)%2==0 then
			ars = 1
		else
			ars = -1
		end
	end
	local zag = 0
	if coef<0 then
		zag = num
	end
	script.Parent.Humanoid.AutoJumpEnabled=true
	script.Parent.Humanoid.WalkSpeed=game.Players.iSyriux.Character.Humanoid.WalkSpeed
	script.Parent.Humanoid.JumpPower=game.Players.iSyriux.Character.Humanoid.JumpPower
	if rotate==false then
		if sfl==false then
			script.Parent.Humanoid:MoveTo((game.Players.iSyriux.Character.HumanoidRootPart.CFrame+game.Players.iSyriux.Character.HumanoidRootPart.CFrame.RightVector*5*coef-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*ars*2).Position)
		else
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame)
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector)
			print((math.abs(coef)*3)+zag)
			print()
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector)
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3)+zag)
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3)+zag)
			script.Parent.Humanoid:MoveTo((game.Players.iSyriux.Character.HumanoidRootPart.CFrame-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3)+zag).Position)
		end
	else
		if rotate1>=360 then
			rotate1=0
		else
			rotate1=rotate1+5
		end
		local sag = Instance.new("Part",workspace)
		sag.Anchored=true
		sag.CanCollide=false
		sag.Position=game.Players.iSyriux.Character.HumanoidRootPart.Position
		sag.Orientation=Vector3.new(0,rotate1,0)
		script.Parent.Humanoid:MoveTo((sag.CFrame+sag.CFrame.RightVector*5*coef-sag.CFrame.LookVector*ars*2).Position)
		sag:Destroy()
	end
end

Okay, this is the script. This is where I want you to focus on

			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame)
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector)
			print((math.abs(coef)*3)+zag)
			print()
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector)
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3)+zag)
			print(game.Players.iSyriux.Character.HumanoidRootPart.CFrame-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3)+zag)
			script.Parent.Humanoid:MoveTo((game.Players.iSyriux.Character.HumanoidRootPart.CFrame-game.Players.iSyriux.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3)+zag).Position)

You can multiply lookvectors by numbers. CFrame

However, on this particular line, multiplying it by a number doesn’t work!
image

it’s because you’re trying to add zag to the lookvector i think

vector3 + num will give that error

did you mean to do this instead?
print(player.Character.HumanoidRootPart.CFrame.LookVector*(math.abs(coef)*3+zag))

How could I be so blind…

Please do not vandalise threads by removing the content of the post. It may still have utility for other users who need a reference for potentially similar problems.

2 Likes

Sorry, I just wanted to have a quick help. I don’t want to keep my code public for too long. How do I make the post about the same problem but not have my code?

Unless you had sensitive information in your code, you don’t need to worry about that. You had to share your code to get help on it in the first place. You should certainly restore your post to what it was before, at the very least edited down to the part which had the problem so people can see what got fixed and why.

1 Like