It's weird because there were no errors in the output.
local SwordFightingArea = game.Workspace local ClassicSword = game.ServerStorage local StarterPack = game.StarterPack local Players = game.Players local NotSwordFightingArea = game.workspace.NotSwordFightingArea local ServerStorage = game.ServerStorage SwordFightingArea.Touched:Connect(function(player) ClassicSword:Clone() local ClassicSword = ClassicSword:FindFirstAncestor("StarterPack") print (player.name .. "has a sword") NotSwordFightingArea.Touched:Connect(function() StarterPack.ClassicSword:Delete() end) end)
I'd appreciate if someone could point out my error/s.
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
instad of starterpack try doing:
game.ServerStorage.ClassicSword:Clone().Parent = game.Players.LocalPlayer.BackPack
and in the string (..) do:
print (player.name.." has a sword")
instead of:
print (player.name .. "has a sword")
i don't thing that's all the mistakes but that's 2 of them