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

Cloning a tool Isn't working properly, can anybody help?

Hello! I'm currently trying to figure out this problem i am having but i still can't find any solutions, and i'm wondering if anybody could help me figure this out.

So the problem is i wrote a Local script to clone the Classic Roblox Sword to the player's backpack, it clones perfectly fine but when i click nothing happens.

Here is the full script:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local PG = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local Player = game:GetService('Players').LocalPlayer
local RP = game:GetService('ReplicatedStorage')
 
function onSeated(isSeated, seat)
	if isSeated then
		PG.ScreenGui.Frame.Visible = true
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 0, 1, 0)
		wait(0.5)
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 100, 1, 0)
		wait(0.5)
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 200, 1, 0)
		wait(0.5)
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 300, 1, 0)
		wait(0.5)
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 400, 1, 0)
		wait(0.5)
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 500, 1, 0)
		wait(0.5)
		PG.ScreenGui.Frame.Frame.Size = UDim2.new(0, 600, 1, 0)
		if PG.ScreenGui.Frame.Frame.Size == UDim2.new(0, 600, 1, 0)
		then
			humanoid.Jump = true
			wait(0.1)
			character.Head.CFrame = CFrame.new(workspace.EXIT.Position)
			-- This is the cloning script --
			local tool = RP.ClassicSword:Clone()
			tool.Parent = Player:WaitForChild("Backpack")
			-----------------------------------------------------------------
		end
	else
		PG.ScreenGui.Frame.Visible = false
	end
end
humanoid.Seated:Connect(onSeated)

(I'm pretty new at scripting lol don't judge.)

Anybody think they can help me?

1 comment

0

Your way better than me lol

1 answer

this also happened to me, the way to fix this is 1. define tool in a way such as this (change lighting to wherever the sword is stored)

local tool = game.Lighting:findFirstChild("ClassicSword") 
local a = tool:clone()
a.Parent = player.Backpack
local b = tool:clone()
b.Parent = player.StarterGear

I struggled with that problem for a while and this fixed it for me.

4 comments

0

Okay, i tried the script out and it still didn't work.

0

also im not trying to put it in starter gear

0

try excluding everything below line 3 if you aren't trying to put it in starter gear

0

I did and it still has the same problem.

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