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

Indirect tool holding? *Edited*

Asked by
adatax 5
9 years ago

Goal Allow a player to hold a "Gun" without using a tool object, as i have toolbar disabled for my fps game.
ProblemThe code gives me this error: 11:24:49.896 - Players.Player.PlayerScripts.Loadout:10: attempt to call method 'clone' (a nil value)
Code "Cloner"

01plr = game.Players.LocalPlayer
02char = plr.Character
03 
04lo = game.ReplicatedStorage.Loadout
05pmr = lo.Rifle
06 
07char:WaitForChild("Humanoid")
08if char.Humanoid then
09    gc = pmr:GetChildren()
10    gc:Clone()
11    gc.Parent = char
12else
13    wait()
14end

Welding

01selected = false
02RSH, LSH = nil, nil
03GRP = nil
04RW, LW = Instance.new("Weld"), Instance.new("Weld")
05anim = "none"
06function WaitForChild(obj, ch_n)
07    local t = time()
08    while not obj:FindFirstChild(ch_n) and time() - t < 10 do wait(0.1) end
09    return obj:FindFirstChild(ch_n)
10end
11script.Parent.Equipped:connect(function()
12    if selected then return end
13    selected = true
14    player = game.Players:playerFromCharacter(script.Parent.Parent)
15    local ch = script.Parent.Parent
View all 84 lines...
0
We don't either. This isn't a request site. User#6546 35 — 9y
0
It was not a request i was asking what was wrong with it,. adatax 5 — 9y
0
How are we supposed to know what's wrong with it? It's your code. Tell us what's wrong with it, then perhaps we can help. Perci1 4988 — 9y
0
updated it with the issue and error i was given adatax 5 — 9y

Answer this question