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

How do I get tools to work?

Asked by
Mr1Vgy 30
9 years ago

So I have LocalScript that is cloning swords out of the ReplicatedStorage, but when it clones the sword into the players backpack, the sword doesn't work! Is it something wrong with the code?

script.Parent.MouseButton1Click:connect(function()
    local sword = game.ReplicatedStorage.ClassicSword:Clone()
    sword.Parent = game.Players.LocalPlayer.Backpack
end)
0
Nothing seems wrong with the code. Maybe something wrong with the sword itself? Make sure the sword is enabled and that this code is in a localscript...otherwise I have no idea why it's not working. dyler3 1510 — 9y
0
Make sure the sword you're cloning in functions first. Does it work when placed directly into the starter pack? RoboFrog 400 — 9y
0
Hmm good idead I'll check that xD Mr1Vgy 30 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

To me, it looks like your script is correct.

If you are using a FREE MODEL: Try to inspect the model for elements/traces of a user-inserted virus. Sometimes, the viruses will prevent scripts from working (just like in versions of Kohls' Admin, it got ruined because so many hackers and virus imputers placed viruses in them, so people switched to LMM. If it's a LinkedSword, it shouldn't take too long to get a new one from the Free Model catalog.

If you made your OWN SWORD: Look through it to make sure all of the parts are alligned. If you made your own sword, it should be working. If you made it yourself and it isn't working, there must be something wrong with a script or somehow a virus got in.

As for your code, it looks perfectly fine. Keep at it, you'll figure it out soon ;)

script.Parent.MouseButton1Click:connect(function()
    local sword = game.ReplicatedStorage.ClassicSword:Clone()
    sword.Parent = game.Players.LocalPlayer.Backpack
end)
0
Thanks! Turned out the sword I had was infected, so I took it out and got another one. Thanks man! :D Mr1Vgy 30 — 9y
0
I knew it. It's happened to me before. Glad I could help! JustGimmeDaBux 18 — 9y
Ad

Answer this question