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

How do I Fix This Backpack Problem? No Errors Show Up In Console

Asked by 3 years ago

So I've been working on this for about 3 hours now. I'm trying to clone a sword from ReplicatedStorage to the player's Backpack through a server script. No errors or anything show up when I execute the code, it just does nothing.

local supersword2 = game.ReplicatedStorage.ClassicSword for _,v in pairs{game.Players:GetPlayerFromCharacter(script.Parent)} do supersword2:Clone().Parent = v.Backpack end end;

1 answer

Log in to vote
0
Answered by 3 years ago

Why are you using an in pairs() loop?

local supersword2 = game.ReplicatedStorage.ClassicSword 
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local clonedSword = supersword2:Clone()
clonedSword.Parent = player.Backpack
0
The player returned nil when I used that script, is there something I'm missing? blockpixelz2 0 — 3y
Ad

Answer this question