Correct script:
game.Players.PlayerAdded:Connect(function(player)
local ClassicSwordClone = game.ServerStorage.ClassicSword:Clone()
local NotSwordFightingArea = game.Workspace.NotSwordFightingArea
ClassicSwordClone.Parent = player.Backpack
print (player.Name .." has a sword")
NotSwordFightingArea.Touched:Connect(function()
StarterPack.ClassicSword:Destroy()
end)
end)
YOU HAVE A VERY BAD PRACTICE: HERES THE ERRORS AND MISTAKES YOU DID
Line 1: Workspace is a service. Okay? Why would you do that, there's a built-in "shortcut" for you called workspace.
Line 2: ServerStorage is a service, not a sword!!!!!!!!!!
Line 3: Instead of locating StarterPack, cloning something into player's backpack you need to use player.Backpack. StarterPack clones it's children inside player's backpack. Don't write BackPack in your code! It's Backpack.
Line 4: Ok this is not like a mistake but you didn't even use it, why
Line 5: It is not game.workspace. You misspelled "Workspace" in the wrong capitalization. ALSO YOU LOCATED WORKSPACE BEFORE MEN WHY
Line 6: Same as line 4
Line 8: You can't touch workspace, its a service, consider changing to game.Players.PlayerAdded:Connect(function(player) if YOU want to detect someone joined. but more easier, you can put the sword in StarterPack.
Line 9: How are you suppose to clone a service
Line 10: You already named a variable called "ClassicSword" man
Line 11: Why would you do unnecessary spaces, do it as print(player.Name .." has a sword!" Also, capitalizate the "Name" correctly okay? Lastly, space before writting your sentence or it looks like this: Someonehas a sword!
Line 12: No errors, but your variable does
Line 13: There is no functions called :Delete, use :Destroy
Line 14/15: No errors
3 comments
Thanks for the reply, I'll certainly have to rethink my approach. However I'm a little confused. In line 9 of the solution code you call the destroy function on the "Classic Sword", that's also in the starter pack. Should I call the function instead on the one that is cloned and that was put in the player's backpack at line 5?
Yes, you can
Assigning 2 function, one of them is giving sword, one of them is destroying sword, will can be repeatedly used instead of once