Note: I removed the Basic Movement so you can only move left or right no jumping or so.
Error 1: It looks Glitched (Not Smooth) Error 2: I cant move in the Air (Ik Anchored but I need an alternative) Error 3: The First Time is completly different
So I wanted the Character to bounche like a Bouncy ball so i thought "Hmmm , maybe I could use TweeningService " and then I made this.
local part = game.Workspace.Ground
local touching = false
while wait(0.1) do
part.Touched:Connect(function(hit)
if touching == false then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
touching = true
local Character = player.Character
local plrname = player.Name
local partTween = game.Workspace:WaitForChild(plrname).HumanoidRootPart
local TweenService = game:GetService("TweenService")
local Position = partTween.Position
local info = TweenInfo.new(
1, -- Time animating
Enum.EasingStyle.Quart, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- Repitions
false, -- Reverse post tween?
0 -- Delay time
)
print("Tween1")
local goal = {
-- HERE
Position = partTween.Position + Vector3.new(0, 20, 0) -- adds plus 20 Y to the old position
}
for _, object in ipairs(Character:GetChildren()) do
if object:IsA("Part" or "MeshPart") then
object.Anchored = true
end
end
TweenService:Create(partTween, info, goal):Play()
wait(1)
for _, object in ipairs(Character:GetChildren()) do
if object:IsA("Part" or "MeshPart") then
object.Anchored = false
end
end
touching = false
print("Tween2")
end
end
end)
end
part.Touched:Connect(function(hit)
if touching == false then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
touching = true
local bv = Instance.new("BodyVelocity")
bv.Name = "bounce"
bv.Velocity = Vector3.new(0,50,0) --change the y value
bv.MaxForce = 30 --change this
bv.Parent = player.Character.HumanoidRootPart
task.wait()
bv:Destroy()
touching = false
end
end
end)
Edit: not completely sure if this would work, but I believe it will.
part.Touched:Connect(function(hit)
if touching == false then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
touching = true
local bv = Instance.new("BodyVelocity")
bv.Name = "bounce"
bv.Velocity = Vector3.new(0,50,0) --change the y value
bv.MaxForce = bv.MaxForce * 30 --change this
bv.Parent = player.Character.HumanoidRootPart
task.wait()
bv:Destroy()
touching = false
end
end
end)
part.Touched:Connect(function(hit)
if touching == false then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
touching = true
local bv = Instance.new("BodyVelocity")
bv.Name = "bounce"
bv.Velocity = Vector3.new(0,50,0) --change the y value
bv.MaxForce = bv.MaxForce * 30 --change this
bv.Parent = player.Character.HumanoidRootPart
task.wait(1)
bv:Destroy()
touching = false
end
end
end)
For Example the easing Sttyle i used was Quint but this would be kind of linear since it always has the same movement and istn fasten up at somepoint or slowed down