Hello! So I’m trying to make a fly script but for some reason the while true do loop doesn’t run. Script:
local player = game.Players.LocalPlayer
local toggle = false
player.Chatted:Connect(function(msg)
local prefix = ":fly"
local splits = msg:split(" ")
if splits[1]:lower() == prefix and player.leaderstats.Rank.Value >= 7 then
--Make him fly
if toggle == false then
toggle = true
local BV = Instance.new("BodyVelocity", player.Character.Torso)
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
while toggle do
print("Yes") --Not printing
BV.Velocity = player:GetMouse().Hit.LookVector * 100
wait()
end
if toggle == true then
toggle = false
--Destroy the BV
player.Character.Torso.BodyVelocity:Destroy()
end
end
end
end)