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

How would I put a model into the character when they equip the tool?

Asked by
Scaii_0 145
5 years ago
Edited 5 years ago

So, I have a script in a tool that basically fires when the tool is equipped. That part works. Then its meant to clone a model and put it into the character. This worked up until a while ago (maybe there was an update to FE?).

local tool = script.Parent 
    print('equipped')
tool.Equipped:connect(function()
    local player = tool.Parent.Parent

    local motor = script.SniperHandle:Clone()   
    local model = game.ServerStorage.tool:Clone() --doesn't work? how do I get this tool?

    local c = script.Parent.Parent
    print('model',c)

--Welding script here (works)

I've tried cloning it from Workspace and from a folder in the character, but nothing seems to be working. I'm starting to wonder whether clone() still works.

How would I get to the model? (This script is in a tool)

1 answer

Log in to vote
1
Answered by 5 years ago

Hey! I'm BlackOrange and I will be helping you.

The problems seems like the Script is a LocalScript. One thing you have to know is that the Client AKA the LocalScript can NOT access the ServerStorage. What I do suggest you do is place the tool inside the ReplicatedStorage.

Here:

local tool = script.Parent 
print('equipped')

tool.Equipped:Connect(function() -- use Connect over connect
    local player = tool.Parent.Parent

    local motor = script.SniperHandle:Clone()   
    local model = game.ReplicatedStorage.tool:Clone() --Place tool in ReplicatedStorage

    local c = script.Parent.Parent
    print('model',c)

--Welding script here (works)

and if like you said everything works then it should work.

Best of luck developer!

Hoped this helped.

0
I had thought about this and if no one responded I was about to ask about the efficiency of storing items in Replicated storage. Scaii_0 145 — 5y
Ad

Answer this question