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

This is my script, why it can't clone a tool from lightning?

Asked by 1 year ago
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local cloneEvent = game.ReplicatedStorage.cloneEvent

local function cloneTool(Player,Tool)
    script.Weapon.Value = Tool
    local clone = game.Lighting:FindFirstChild(script.Weapon.Value):Clone()
    clone.Parent = game.Players:FindFirstChild(Player).Backpack
end

cloneEvent.OnServerEvent:Connect(cloneTool)

This suppose to copy a weapon with a lauched name from lightning

but it give this error: Workspace.Cloner:7: attempt to index nil with 'Clone'

0
Why do you want to clone a tool from lighting service? You coulld just use the replicated storage? And also, why are you using the value instead of defining the tool first? Fouxelefr 7 — 1y

1 answer

Log in to vote
1
Answered by 1 year ago

I think you need to get Lighting service

local Lighting = game:GetService("Lighting")

This may fix the issue

Ad

Answer this question