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

What could be causing the normal LinkedSword to not function when cloned?

I have tried to make a GUI button that gives you an item when you click on it, works pretty well, until I noticed that the ClassicSword or LinkedSword does not function properly after cloning it. Basically, you can only hold the sword, and it does nothing else.

Here is my giver script:

local p = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect (function()
 local tool = script.Parent.LinkedSword:clone()
tool.Parent = p.Backpack
end)

2 comments

0

Hey! You yeah you! Don't expect us to fix free models! If you want us to help, make your own sword.

0

You are using a local script, which means your code is client-sided and will not work with this. JJBloxxer has the correct solution

1 answer

In the ReplicatedStorage insert a RemoteEvent and your sword. Next, insert a Script inside of the ServerScriptService and in it type the following code.

local event = game.ReplicatedStorage.RemoteEvent

event.OnServerEvent:Connect(function(player)
	game.ReplicatedStorage.ClassicSword:Clone().Parent = player.Backpack
end)

Inside your button insert a LocalScript and in it type the following code.

local event = game.ReplicatedStorage.RemoteEvent

script.Parent.MouseButton1Click:Connect(function()
	event:FireServer()
end)

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