So, I am trying to make a space game where you are able to move around in low gravity. I know that Workspace has a property, gravity
, but I want the player to be able to go downwards, upwards, move forwards, and backwards. With the gravity property it really just keeps you up as if you’re walking in air, but it isn’t like floating around and you cannot go up/down. Any ideas?
you could put in a local script a check for if the player is jumping, and if they are, you could create a bodyvelocity for the player
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Space then
local bodyVel = Instance.new("BodyVelocity")
bodyVel.Parent = game.Players.LocalPlayer.Character.HumanoidRootPart
bodyVel.Velocity = Vector3.new(0,50,0)
bodyVel.P = 2000
wait(1)
bodyVel:Destroy()
end
end)
It sorta works(sorta)
I’d suggest using a BodyForce
instead (I believe you can get the Character’s Total Mass somehow) And add a debounce as well so that they aren’t spamming new Instances to the
HumanoidRootPart
Didn’t think about spamming, thanks for the feedback!
Should I change the new instance to be BodyForce?
It really just lets me jump higher, is there anyway I could make the game be like floating around in space where you can move in any direction?
Actually I would suggest using vectorForce and parent the vectorForce to HumanoidRootPart and set the attachment to the attachment automatically parented to humanoidRootPart and then set the Force
I think there’s a property in CustomPhysicalProperties called Density which will be useful for this. If you want the player to be walking as in space, get all their parts and lower their Density.
This confused me a little, LOL. So basically would I do this all within a script?
That’s a great idea, I’ll do that.