Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you fix this trampoline script from breaking on server?

Asked by 6 years ago

Someone moderated my previous post, because it apparently was a "duplicate" of some other psots. Those posts used a different method, and the answers are what I was already doing. None of those answers on those posts helped me whatsoever. I am asking, why does using BodyVelocity with a trampoline turn me invisible and put input lag on me.

local bouncestrength = script.Parent.Parent.bouncepower.Value / 6
local debris = game:GetService("Debris")
local tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
            1,
            5,
            1,
            0,
            false,
            0
)

local property = {
            Offset = Vector3.new(0, 0, 0);
            Scale = Vector3.new(1, 1, 1)
}

local propertyb = {
            Color = script.Parent.Parent.regularcolor.Value;
}

debounce = true
script.Parent.Parent.Touched:connect(function(part)
    local a = part.Parent:FindFirstChild("Humanoid")
    if a ~= nil and debounce == true and part.Parent.Torso.Position.Y + 2.87 > script.Parent.Parent.Position.Y + 0.5 then
        debounce = false
        script.Parent.Offset = Vector3.new(0, 0.6, 0)
        script.Parent.Scale = Vector3.new(1.2, 0.8, 1.2)
        script.Parent.Parent.Color = script.Parent.Parent.bouncecolor.Value
        local force = script.Parent.Parent.BodyVelocity:Clone()
        force.Parent = part.Parent.Torso
        debris:AddItem(force, 0.3)
        part.Parent.Torso.Velocity = Vector3.new(part.Parent.Torso.Velocity.X, part.Parent.Torso.Velocity.Y + script.Parent.Parent.bouncepower.Value + bouncestrength, part.Parent.Torso.Velocity.Z)
        local tween = tweenservice:Create(script.Parent, tweeninfo, property)
        local tweenb = tweenservice:Create(script.Parent.Parent, tweeninfo, propertyb)
        tween:Play()
        tweenb:Play()
        wait(0.25)
        force:Destroy()
        debounce = true
    end
end)

Does anyone know how to fix this? It only seems to work in studio.

0
If this script only works in studio, possibly change it to a local script. BunnyFilms1 297 — 6y

Answer this question