Answered by
4 years ago Edited 4 years ago
Correct script:
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | local ClassicSwordClone = game.ServerStorage.ClassicSword:Clone() |
03 | local NotSwordFightingArea = game.Workspace.NotSwordFightingArea |
05 | ClassicSwordClone.Parent = player.Backpack |
06 | print (player.Name .. " has a sword" ) |
08 | NotSwordFightingArea.Touched:Connect( function () |
09 | StarterPack.ClassicSword:Destroy() |
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