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

Animal spawning tool breaks?

Asked by 6 years ago

So I have tried to make a tool spawn a certain model, a horse. The thing is that it work perfectly in filtering enabled off, and solo and everything. Here is the code:

comn = script.Parent

function onButton1Down(mouse)

    local model = game.ReplicatedStorage.Animal:clone() 

    model.Parent = game.Workspace
    model:MakeJoints()
    model:MoveTo(mouse.hit.p+Vector3.new(0,1,0))
    wait()
    comn.Unequipped:connect(Unequip)
    script.Parent:remove() 

end

function onEquippedLocal(mouse)

    if mouse == nil then
        print("Mouse not found")
        return 
    end

    mouse.Icon = ""
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)  
end


comn.Equipped:connect(onEquippedLocal)

Once you spawn the animal, it removes the spawner tool too.

Thing is, it spawns the animal nice and everything. But it seems to be broken, wont move, and is stiff.. Not even it's little saddle will work.. It DOES work when the game is opened and the animal is already in the workspace, but it breaks when it's spawned with the tool.

I was considering using remoteevents to send a signal from this localscript to a global script, but I'm not so sure how I could make that work, or if it would even make a difference at all. Please help, I've been transitioning from non-FE to FE and it's been so much, but I think I kind of get the gist of the remoteevents and stuff.

Answer this question