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

"Trip" script causing "Growing" object to be displaced by player. How can it be fixed?

Asked by 7 years ago
Edited 7 years ago

Greetings. In my game, I have an object which frequently creates "waves" of energy which grow outward and knock people back. However, whenever a player touches the growing object it teleports/moves above their head.

EDIT: I have found the source of the problem, it is within the "Trip" code in the growing object.

Does anybody know how to create a "Trip" script without causing the growing object to be moved?

The trip script:

bin = script.Parent


function onTouched(part)
    local h = part.Parent:FindFirstChild("Humanoid")
    if h~=nil then
        h.Parent.UpperTorso.RotVelocity = Vector3.new(40,0,0)
    elseif part.Parent.className == "Hat" then
        part.Parent.Parent.Torso.RotVelocity = Vector3.new(40,0,0)
    end
end

bin.Touched:connect(onTouched)

The grow script:

m = script.Parent
limit = 70
while true do
    local inc = 1
    m.Size = m.Size + Vector3.new((inc), 0, (inc))
    wait(0.005)
    if m.Size == Vector3.new((limit), 0.5, (limit)) then
        while true do
            m.Transparency = m.Transparency + 0.2
            wait(0.01)
            if m.Transparency <= 1 then
                m:Remove()
            end
        end
    end
end

Answer this question