game.ReplicatedStorage.SendRequest.OnServerEvent:Connect (function(Player,Target,Velocity,Damage) Target.leaderstats.Damage.Value = Damage if Target.Character.Torso:FindFirstChild("BV") == nil then BV = Instance.new("BodyVelocity") BV.Name = "BV" BV.Parent = Target.Character.Torso end Target.Character.Torso.BV.Velocity = Velocity wait (0.5) Target.Character.Torso.BV.Velocity = Vector3.new(0,0,0) Target.leaderstats.LastHit.Value = Player.Name end)
So, when i was making this script, i initially just wanted to apply a velocity to the player, and have roblox physics just slow the player back down to a halt.
It didn't work because some one told me to make the object "wake up". He meant put another force on it, then apply the velocity, but he reccomended using body velocitys.
I used them, and they make knockback unnatural. How can i "wake up" the player and just put a normal velocity on them?
In regards the exploitation why don't you just do
game.ReplicatedStorage.SendRequest.OnServerEvent:Connect (function(Player,Target,Velocity,Damage) if game.Workspace.PlayerInfo[Player.Name].Cooldown.Value = false then game.Workspace.PlayerInfo[Player.Name].Cooldown.Value = true local cooldownOff = coroutine.wrap(function(player, time) wait(time) game.Workspace.PlayerInfo[Player.Name].Cooldown.Value = false end) newThread(Player,3) -- 3 Seconds -- This bit here just makes a new mini-program called a coroutine that waits without making everything else stop. This means that you can do cooldown as well as not stopping this program. Just warning - Don't do too many of these, if you are likely to have a big game or something I would skip the coroutine and put the code inside it at the end. Target.leaderstats.Damage.Value = Damage if Target.Character.Torso:FindFirstChild("BV") == nil then BV = Instance.new("BodyVelocity") BV.Name = "BV" BV.Parent = Target.Character.Torso end Target.Character.Torso.BV.Velocity = Velocity wait (0.5) Target.Character.Torso.BV.Velocity = Vector3.new(0,0,0) Target.leaderstats.LastHit.Value = Player.Name end end)
For the actual original question I'm not sure, I haven't fiddled with Physics engines yet and I've only been at Lua for a week.
game.Players.PlayerAdded:Connect(function(player) local playerFolder = Instance.new("Folder") playerFolder.Name = player.Name playerFolder.Parent = game.Workspace.PlayerInfo -- It is a lot less laggy to define the parent after all of the other stuff than to do Instance.new("Object",Parent) local Cooldown = Instance.new("BoolValue") Cooldown.Name = "Cooldown" Cooldown.Value = false Cooldown.Parent = playerFolder end)