Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Swords not working properly when cloned from ReplicatedStorage?

So basically, i'm trying to make a basic swordfighting game with a kills for cash script, the cash script has one small problem, but my main problem is this script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function(click)
	if player.leaderstats.Coins.Value >= 25 then
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 25
		
		game.ReplicatedStorage.Tools.Firebrand:Clone().Parent = player:WaitForChild("Backpack")
		game.ReplicatedStorage.Tools.Firebrand.SwordScript:Clone().Parent = player:WaitForChild("Backpack")
	end
end)`

This script is supposed to clone a tool from my ReplicatedStorage Tools folder, but when it gives the sword, the sword doesn't swing or make the sound. It won't even deal damage. Can anyone help me fix this?

Note: i am really new to scripting, this is from a tutorial

1 comment

0

Is it in a LocalScript?

1 answer

I've had the same experience, but the tools work when you clone the items from lighting Use this then put the tools in Lighting

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function(click)
    if player.leaderstats.Coins.Value >= 25 then
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 25

        game.Lighting.Tools.Firebrand:Clone().Parent = player:WaitForChild("Backpack")
        game.Lighting.Tools.Firebrand.SwordScript:Clone().Parent = player:WaitForChild("Backpack")
    end
end)`

2 comments

0

Still doesn't work :/

0

in fact it worked worse :/

This discussion is preserved as it was. New answers, comments, and votes are closed.