I want to make it so when I add a new value to the player which slows them down once they get within 100 studs of the group (likely to change) or when they touch a certain part that new value gets destroyed or removed. I think either way will work.
I’m not exactly sure why it isn’t working. (Yes the player is within 100 studs of the ground).
The script was given to me by somebody else on here because I couldn’t figure out how to slow the player’s fall. Now I got that working but I can’t bring the player back to being normal.
This is the script:
local part = script.Parent-- Get the part that the player will touch local RunService = game:GetService("RunService") part.Touched:Connect(function(otherpart) -- Connect to the part's touched event local hrp = otherpart.Parent:FindFirstChild("HumanoidRootPart") -- Find the player's HumanoidRootPart local bodyvelocity = hrp:FindFirstChildWhichIsA("BodyVelocity") -- Check if the player has a body velocity attached if hrp and not bodyvelocity then local newvalue = Instance.new("BodyVelocity") -- Attach a body velocity to the player's humanoid root part to give them an upward push newvalue.Velocity = Vector3.new(0, -25, 0) -- give an upward velocity of 10000 in the Y-axis (Changed to -25) newvalue.MaxForce = Vector3.new(10000, 10000, 10000) -- Set the max force to be able to apply to the player's humanoid rootpart newvalue.P = 5000 -- Set the damping property of the body velocity to 5000 newvalue.Parent = hrp -- Parent the body velocity to the player's humanoid root part -- Function to be run every render step to check if the player is within 100 studs of the ground --***Start of part that doesn't work*** local function onHeartbeat() if hrp.Position.Y <= 100 then -- Check if the player's humanoid root part is within 100 studs of the ground hrp.BodyVelocity.Velocity = Vector3.new(0,0,0) -- Set the player's velocity to (0,0,0) hrp.BodyVelocity.MaxForce = Vector3.new(0,0,0) -- Set the max force to (0,0,0) to stop applying the upward force newvalue:Destroy() -- Remove the bodyvelocity RunService:RemoveHeartbeat(onHeartbeat) -- Remove the heartbeat event end end -- Bind the heart beat function to the render step RunService:BindToRenderStep("slowFall", Enum.RenderPriority.First.Value, onHeartbeat) end end) --***End of part that doesn't work*** --This will effectively slow down their fall as they get closer to the ground.
My Random Speech (Not related to this)
Sometimes I rely on the developer forum in order to figure this stuff out. I always try to not ask people for straight up scripts and do my best to write a script before asking for help, however even then I have ended up having to ask people for a script because sometimes they will say to do this and that and then do this and I don’t even understand what they mean. The other times are when I have a script that has a major error in it which I do try to minimize if I can. I just don’t want to ask people for entire scripts or systems like the developer forum says because I want to at least do something and not have other people make an entire game for me. I’m trying to get better at certain things when making games but I have such little time to do things sometimes that I can barely put in time to learn any of that stuff. I usually only find tutorials when I need to find out something in the exact moment (Which has happened a lot with my other game which is way more advanced compared to what I have experience doing). I guess I’m kind of a casual style game developer. I don’t make games for a living, but I also want to make games that are at least decent. My best one would be Hypnagogia which is a 2D game that I have paused working on. It requires more advanced things and scripts that I am trying to do. It has only a small amount of gameplay in it because each part of it takes so long to make. I made cutscenes without movement though which is better than what I have made in the past. If you want an idea of what the game is like I made it to be similar to the game “A Lucid Dream”. You may also be able to find what the game looks like in my old topics about it. I hope to release it sometime within the next few years but it depends on how much time and effort I put into it. I want to make a moon follow the player and then when the player reaches a certain part the moon becomes the sun but I don’t even know how to make a part follow the player. I might be able to figure out how to make it transform using an event where one part touches another part but it would take a lot of figuring out. Anyways that was my long speech about whatever came to mind. Thanks for reading it .