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

The morph script isn't working correctly, how do I fix this problem?

Asked by 2 years ago

This script turns the player into Noob, but just creates a noob to me instead of the player turning into them.

The script:

local Tool = script.Parent;

enabled = true

local drink = Tool.Drink

function onActivated()
    if not enabled  then
        return
    end

    enabled = false
    Tool.GripForward = Vector3.new(-1, 0, -0)
    Tool.GripPos = Vector3.new(-.2, -0, -1.5)
    Tool.GripRight = Vector3.new(0, 0, -1)
    Tool.GripUp = Vector3.new(0, 1, 0)


    Tool.Handle.DrinkSound:Play()

    wait(1.3)

    drink.Value = drink.Value + 1

    Tool.GripForward = Vector3.new(-1, 0, -0)
    Tool.GripPos = Vector3.new(0.25, 0, 0)
    Tool.GripRight = Vector3.new(0, 0, -1)
    Tool.GripUp = Vector3.new(0,1,0)

    enabled = true

    if drink.Value >= 3 then
        local char = Tool.Parent
        local noob = game.Workspace.Noob:Clone()

        noob.HumanoidRootPart.Anchored = false
        noob:SetPrimaryPartCFrame(char.PrimaryPart.CFrame)

        char = noob
        noob.Parent = workspace
        Tool:Destroy()
    end

end

function onEquipped()
    Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

Answer this question