I’m working on an arena where if the Client lands in the pit, their character bounces up into the air with the addition of losing a life from their heart. Primarily, I’m just focusing the bouncing part.
I’ve been tinkering with the Velocity in the properties and I’ve got say that it doesn’t really do so well. Sometimes the Roblox’s physics engine can’t comprehend how high the character should really be going up.
So I’ve create this chunk a code where it inserts a BodyVelocity within a character for only a quarter of a second, then destroys that said velocity.
I’ve gotta say, the results are pretty differential and I’m preferring BodyVelocity over the Property one. I wish this DevForum would allow me to post videos for me to show, but alas it still has problems with Quicktime for me.
Basically, I’m just wondering if this script is impractical:
LocalScript in StarterGui
local RemoteEvent = script.Events:WaitForChild("Bounce")
local debounce = true
local Player = game.Players.LocalPlayer
game.Workspace:WaitForChild(Player.Name)
game.Workspace.BouncePart.Touched:Connect(function(hit)
if debounce then
debounce = false
RemoteEvent:FireServer() -- Fire remote
debounce = true
end
end)
RemoteScript
local RemoteEvent = script.Parent.EventsFolder:WaitForChild("Bounce")
RemoteEvent.OnServerEvent:Connect(function(Player)
local Vel = Instance.new("BodyVelocity")
Vel.Parent = Player.Character.Torso
Vel.Name = "BounceVelocity"
Vel.MaxForce = Vector3.new(0,math.huge,0)
Vel.P = math.huge
Vel.Velocity = Vector3.new(0,100,0)
wait(.25)
for _, v in pairs(Player.Character.Torso:GetDescendants()) do --Just in case there's too many velocities being created
if v:IsA("BodyVelocity") then
v:Destroy()
end
end
end)
Will I be facing some performance issues by doing this rather than doing trusting the Velocity within the Part properties?
EDIT: Realized this is more of a #help-and-feedback:code-review question rather than a #help-and-feedback:scripting-support question.