I'm trying to fix a code for a friend, but it says "statement spans multiple lines, as an error" Also the speed changer won't work. I have no idea what to do, i've never had these errors before
Please help my friend
Script:
function Launch(char, target, speed)
char.Torso.BodyPosition.position = target.Position
print("Loop started. Target brick: " .. target.Name)
while char.Parent ~= nil do
if (target.Position - char.Torso.Position).magnitude < 20 then
print("Player at target")
return
else
print((target.Position-char.Torso.Position).unit*speed)
char.Torso.BodyPosition.maxForce = Vector3.new(
500*math.abs(((target.Position - char.Torso.Position).unit*speed).x),
100*math.abs(((target.Position - char.Torso.Position).unit*speed).y),
500*math.abs(((target.Position - char.Torso.Position).unit*speed).z))
char.Torso.BodyGyro.cframe = CFrame.new(char.Torso.Position, char.Torso.Position+char.Torso.Velocity)
end
wait(0.1)
end
end
function MakeWeightless(m)
local p = m:getChildren()
for i = 1, #p do
if p[i].className == "Part" or p[i].className == "Seat" then
local g = Instance.new("BodyForce")
g.force = Vector3.new(0, p[i]:getMass()*196.2, 0)
g.Parent = p[i]
elseif p[i].className == "Model" or p[i].className == "Hat" then
MakeWeightless(p[i])
end
end
end
function RemoveWeightless(m)
local p = m:getChildren()
for i = 1, #p do
if p[i].className == "Part" or p[i].className == "Seat" then
local g = p[i]:findFirstChild("BodyForce")
if g ~= nil then g:remove() end
elseif p[i].className == "Model" or p[i].className == "Hat" then
RemoveWeightless(p[i])
end
end
end
function onTouched(part)
local players = game.Players:getChildren()
for i = 1, #players do
if players[i]:findFirstChild("Launched") == nil and players[i].Character ~= nil then
if players[i].Character:IsAncestorOf(part) then
local h = players[i].Character:findFirstChild("Humanoid")
if h.Health ~= 0 then
if players[i].Character:findFirstChild("Torso") ~= nil then
local debounce = Instance.new("IntValue")
debounce.Name = "Launched"
debounce.Parent = players[i]
MakeWeightless(players[i].Character)
local bg = Instance.new("BodyGyro")
bg.P = 9001 -- =3
bg.D = 1009
bg.maxTorque = Vector3.new(10000, 10000, 10000)
bg.Parent = h.Parent.Torso
local bp = Instance.new("BodyPosition")
bp.P = 10000
bp.D = 5000
bp.Parent = h.Parent.Torso
bp.maxForce = Vector3.new(0, 0, 0)
local point = game.Workspace.locationz1
local speed = 1000
Launch(players[i].Character, point, speed)
local point = game.Workspace.locationz2
local speed = 1000
Launch(players[i].Character, point, speed)
local point = game.Workspace.locationz3
local speed = 1000
Launch(players[i].Character, point, speed)
if players[i].Character ~= nil then
RemoveWeightless(players[i].Character)
bg:remove()
bp:remove()
sp:remove()
h.Parent.Head.CanCollide = true
h.Parent.Torso.CanCollide = true
debounce:remove()
end
end
end
end
end
end
end
script.Parent.Touched:connect(onTouched)

2 comments
put the results in variables then pass the variables to the print function. You are assigning something in the print functions as well?
Never mind i saw it wasn't the entire script so I'll update it