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)
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.