I’m not great when it comes to CFrame related stuff and I’ve got 2 issues as a result.
First riding the dragon is jittery.
Somehow I made it lose its smoothness.
https://gyazo.com/eb67cccd5ef8ae5ac0193b2f5c8b60c6
Client Code
local RS = game:GetService("RunService")
local Event = script.Parent.Remote.Value
local Running = false
script.Parent.AncestryChanged:Connect(function()
Running = false
end)
Event.OnClientEvent:Connect(function(Mode)
if Mode == "Run" and Running ~= true then
Running = true
while Running == true do
RS.Heartbeat:Wait()
local DirCF = game.Workspace.CurrentCamera.CFrame
Event:FireServer(DirCF)
end
elseif Mode == "Stop" then
Running = false
end
end)
game:GetService("UserInputService").InputBegan:Connect(function(obj, gpe)
if not gpe then
if obj.KeyCode then
if obj.KeyCode == Enum.KeyCode.Q then
Event:FireServer(nil, "Q")
elseif obj.KeyCode == Enum.KeyCode.G then
Event:FireServer(nil, "G")
elseif obj.KeyCode == Enum.KeyCode.H then
Event:FireServer(nil, "H")
end
end
end
end)
Direction Event on Server
DirectionEvent = Services.Event.OnServerEvent:Connect(function(Player, Dir, Key)
if not Key then
if Player == P and OUI:FindFirstChild("MainFrame") and OUI.MainFrame.Fly.Text ~= "FLY (G)" then
if OUI.MainFrame.Dash.Text ~= "DASH (Q)" then
BV.Velocity = S.CFrame.lookVector * 50
else
BV.Velocity = Vector3.new(0, 0, 0)
end
if Dir.LookVector then
BG.CFrame = Dir
--BG.CFrame = CFrame.new(S.Position, S.Position + Vector3.new(Dir.LookVector.X, Dir.LookVector.Y, Dir.LookVector.Z))
end
end
else
if Key == "H" then
Loader.Attack:FireBreath(Loader, Services, Dragon, Animation.LookBack, DM, Animation.Breath, StopMode, OUI, P, C)
elseif Key == "Q" then
Loader.Control:Dash(Loader, Services, Animation.LookBack, OUI, Animation.IdleFly, Animation.Fly, BV, DM, Dragon, BG)
elseif Key == "G" then
Loader.Control:Fly(Loader, Services, Animation.LookBack, OUI, Dragon, DM, DragonCollision, DragonBottom, BV, P, Animation.Fly, Animation.IdleFly, Animation.Idle, Animation.Liftoff, BG, C, Animation.Breath, StopMode)
end
end
end)
Then my landing is just a mess
https://gyazo.com/d7f49c81bb60fc9fadf1163b268cbcfe
Landing Server
function module:Land(Loader, Services, C, Fly, Liftoff, IdleFly, BV, D, OUI, DragonCollision, DragonBottom, BG, DM, P, Idle)
Fly:Stop()
Liftoff:Stop()
IdleFly:Play()
BV.Velocity = Vector3.new(0, -50, 0)
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BV.P = math.huge
local Landed = false
while task.wait(.1) do
if D:FindFirstChild("HP") and D.HP.Value > 0 then
if OUI:FindFirstChild("MainFrame") and OUI.MainFrame.Fly.Text ~= "FLY (G)" then
break
end
end
BV.Velocity = Vector3.new(0, -50, 0)
DragonCollision.Massless = false
DragonBottom.Massless = false
for _,v in pairs(DragonBottom:GetTouchingParts()) do
if not v:IsDescendantOf(D) and not v.Parent:FindFirstChildOfClass("Humanoid") and not v.Parent.Parent:FindFirstChildOfClass("Humanoid") then
-- assumed landed
IdleFly:Stop()
task.wait(.2)
BV.MaxForce = Vector3.new(50, 50, 50)
BV.P = 5000
BG.MaxTorque = Vector3.new(0, 0, 0)
BG.P = 100
Idle:Play()
if P then
Services.Event:FireClient(P, "Stop")
end
task.wait(1)
DM.Anchored = true
if D:FindFirstChild("DragonSeat") then D.DragonSeat.Anchored = true end
print'landed'
if D.HP.Value <= 0 then
D:Destroy()
end
Landed = true
D.Flying.Value = false
end
end
if Landed then
break
end
end
end