So, I made a script that SHOULD remove weapons (in this case, the "ClassicSword") when touched a brick called "RedInteractive". For some reason - it doesn't work. Output is not giving any errors, but it doesn't print out what I've told it to print. Can anyone help? Big thanks!
Sincerely, Director1406.
P.S. Code is bellow
p = game.Players.LocalPlayer
game.Workspace.RedInteractive.Touched:connect(function(hit)
if p.Backpack:FindFirstChild("ClassicSword") == true then
print("entering castle, removing weaps")
p.Backpack.ClassicSword:Destroy()
elseif p.Backpack:FindFirstChild("ClassicSword") == false then
print("leaving castle, giving back weaps")
local copy = game.Lighting.ClassicSword:Clone()
copy.Parent = p.Backpack
end
end)

2 comments
is this in a LocalScript (as you're using LocalPlayer)?
Yes it is.