yes you might be right, i tried using heartbeat instead but still velocity is around 0 when the player lands
actually from what i have read, serverside scripts can’t be accessed by anything, unlike local scripts they cannot be decompiled by third party software. I will consult others here on devforum regarding this. Thank you either way
I made a script once that measured the highest value of the changing velocity property of a part. seems to work well. (Used it to measure projectile speeds on a physics catapult)
How tho? Would it allow for migration of his script server side? I am really reluctant to use a local script for damage
It assumes there is no slowing down then reaccelerating before impact.
If you had it run (or something similar) each freefall, it could work. Then you just apply damage base on max impact speed.
local rock = script.Parent
local maxVelocity = 0
local currentIsLarger = true
while currentIsLarger do
if maxVelocity <= rock.Velocity.Magnitude then
maxVelocity = rock.Velocity.Magnitude
else
currentIsLarger = false
end
wait()
end
print(maxVelocity)
raycast below the character with runservice loop, and if the instance’s material changes from nil
to Enum.Material.IDK
then fire an event declaring that the player has landed
Why not just do this inside of a character? This solution is pretty simple and very reliable. May be exploitable but I’m not one of those people that cry about exploits that prevent such a small thing such as fall damage, just ban them, or don’t even do anything.
This can happen when jumping but you can use ways to prevent that.
--// Variables
local Character = script.Parent
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Root = script.Parent:WaitForChild("Torso",math.huge)
local BuiltupMagnitude = 0
local FallingStates = {Enum.HumanoidStateType.Freefall}
Humanoid.StateChanged:Connect(function(old,new)
print("Current State : "..tostring(new))
if table.find(FallingStates,new) and not table.find(FallingStates,old) then
repeat
local Magnitude = Root.Velocity.Magnitude
if Magnitude>BuiltupMagnitude then
BuiltupMagnitude = Magnitude
end
task.wait()
until not table.find(FallingStates,Humanoid:GetState())
if BuiltupMagnitude>=30 then
Humanoid.Health-=BuiltupMagnitude/2
BuiltupMagnitude = 0
end
end
end)