I want the mod to stop taking my question down. I did nothing wrong i'm just asking a question.Also the player have a sword and when they walk above the brick their sword get removed. Please help.Thanks
COMMUNITY QUESTION
How do I make it so when the player touch the brick their sword get remove?
1 answer
vvvv-Local Version-vvvv
wait ()
game.Workspace.TestBrick.Touched:Connect(function ()
local Sword = game.Players.LocalPlayer.Backpack:FindFirstChild("Sword")
if Sword then
Sword:Destroy()
end
end)
put this in a local script in the backpack or start player scripts
function onTouch(part)
local Player = game.Players:FindFirstChild(part.Parent.Name)
if Player ~= nil then
local Sword = part.Parent:FindFirstChild("Sword")
local SwordInBackpack = Player.Backpack:FindFirstChild("Sword")
if Sword ~= nil then
Sword:Destroy()
end
if SwordInBackpack ~= nil then
SwordInBackpack:Destroy()
end
end
end
script.Parent.Touched:connect(onTouch)
try this
14 comments
0
if it does not work please tell me the error message
0
Is it a local script?
0
nope
0
facepalm
0
I believe thats the problem.
0
This is a server script placed in the brick that should delete the sword
0
it's supposed to be local
0
I tried it and it worked
0
Copy the script, pase it into a local script inside the brick.
0
not server-wide
0
But it works
0
server-wide would lag the game
0
@Darkcraft10 If you just put the script into a local script it doesnt work anymore
0
thank you
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Well, you are requesting a script, which they don't want you to do. But I'll see what I can do. Give me a few.