Hi Helpers, I've been scripting a place for a bit and I'm using WhupDup's weaponry. Go check it out if you'd like. Anyways, I'm trying to clone a weapon that is in replicated storage and put it into a players backpack. here is the code. (ignore lines 1-38, useless) Once I run it, the error returns, "Body is not a valid member of Hopperbin" PS, Body is part of the weapon that I am trying to clone.
local SGui = Instance.new("ScreenGui") SGui.Parent = script.Parent local Duel = Instance.new("TextButton") local Player = game.Players.LocalPlayer Duel.Parent = SGui Duel.Position = UDim2.new(0.45, 0, 0, 0) Duel.Size = UDim2.new(0.15, 0, 0.1, 0) Duel.Text = "Switch Teams" Duel.Font = "Bodoni" Duel.BackgroundTransparency = 0.4 Duel.BackgroundColor3 = Color3.new(0, 0, 0) Duel.TextColor3 = Color3.fromRGB(255, 255, 255) Duel.TextSize = 27 Duel.BorderSizePixel = 0 Duel.TextStrokeColor3 = Color3.fromRGB(214, 205, 81) Duel.TextStrokeTransparency = 0.7 local TKM = game.ReplicatedStorage.TKMusket local TKR = game.ReplicatedStorage.TKRifle local TKS = game.ReplicatedStorage.TKSabre local M = game.ReplicatedStorage.Musket local R = game.ReplicatedStorage.Rifle local S = game.ReplicatedStorage.Sabre local function SwitchtoShooting() Player.Team = game.Teams["Shooting Stalls"] Player.Character.Humanoid.Health = 0 end local function SwitchtoDuelling() Player.Team = game.Teams.Duelling Player.Character.Humanoid.Health = 0 end local function SwitchTeam() if Player.Team == game.Teams.Duelling then SwitchtoShooting() else SwitchtoDuelling() end end local function EnableTK() wait(0.2) Player.Backpack:ClearAllChildren() local TKMC = TKM:Clone() wait(0.1) TKMC.Parent = Player.Backpack local TKRC = TKR:Clone() wait(0.1) TKRC.Parent = Player.Backpack local TKSC = TKS:Clone() wait(0.1) TKSC.Parent = Player.Backpack end local function DisableTK() wait(0.2) Player.Backpack:ClearAllChildren() local MC = M:Clone() wait(0.1) MC.Parent = Player.Backpack local RC = R:Clone() wait(0.1) RC.Parent = Player.Backpack local SC = S:Clone() wait(0.1) SC.Parent = Player.Backpack end if Player.Team == game.Teams.Duelling then EnableTK() end if Player.Team == game.Teams["Shooting Stalls"] then DisableTK() end Duel.MouseButton1Click:connect(SwitchTeam)
This is inside a LocalScript inside StarterGui. A response would be appreciated. Thanks a lot!
HopperBins are deprecated.