I’m trying to make a Hold Space to Glide System but I don’t know how to make the character fall slowly, can someone help me?
These are the scripts I’m currently using
Server Script
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataStoreService = game:GetService("DataStoreService")
local UserInputService = game:GetService("UserInputService")
local Actions = ServerStorage.Actions
Players.PlayerAdded:Connect(function(Plr)
local ActionsClone = Actions:Clone()
Actions.Parent = Plr
Plr.CharacterAdded:Connect(function(Char)
local Glide = Instance.new("BodyVelocity", Char)
Glide.Name = "Glide"
Glide.P = 10000
Glide.MaxForce = Vector3.new(0, 0, 0)
Glide.Velocity = Vector3.new(0, -10, 0)
end)
end)
ReplicatedStorage.ActionsRemotes.StartGliding.OnServerEvent:Connect(function(Plr)
warn("Planando = True")
Plr.Actions.Gliding.Value = true
game.Workspace[Plr.Name].Glide.MaxForce = Vector3.new(0, 100000, 0)
print(tostring(game.Workspace[Plr.Name].Glide.MaxForce))
end)
ReplicatedStorage.ActionsRemotes.StopGliding.OnServerEvent:Connect(function(Plr)
warn("Planando = False")
Plr.Actions.Gliding.Value = false
game.Workspace[Plr.Name].Glide.MaxForce = Vector3.new(0, 0, 0)
print(tostring(game.Workspace[Plr.Name].Glide.MaxForce))
end)
Local Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
wait(0.5)
local Plr = script.Parent.Parent
local Char = game.Workspace[Plr.Name]
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Space then
local HumanoidState = Char.Humanoid:GetState()
if HumanoidState == Enum.HumanoidStateType.Freefall then
ReplicatedStorage.ActionsRemotes.StartGliding:FireServer()
end
end
end)
UserInputService.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Space then
if Plr.Actions.Gliding.Value == true then
ReplicatedStorage.ActionsRemotes.StopGliding:FireServer()
end
end
end)