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

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

Asked by 4 years ago

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?

0
Your way better than me lol iivSnooxy 248 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

0
Okay, i tried the script out and it still didn't work. elijah56447 0 — 4y
0
also im not trying to put it in starter gear elijah56447 0 — 4y
0
try excluding everything below line 3 if you aren't trying to put it in starter gear jraffey 1 — 4y
0
I did and it still has the same problem. elijah56447 0 — 4y
Ad

Answer this question