Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do I make it where when you touch a brick it remove your sword only your sword? [closed]

Asked by 6 years ago

I need help with this if you could help I'll be thankful. Thanks!

0
Where is the sword, In StarterPack? Make sure you add more detail into your questions to help us out. Darkcraft10 20 — 6y
0
Also is just just called "Sword"? Darkcraft10 20 — 6y
0
Like I want to make it like when the player touches the brick the only thing that disappear is his/her sword. Nothing eles but her/his sword. madlyholland -53 — 6y
0
Hold on Darkcraft10 20 — 6y
View all comments (2 more)
0
ok madlyholland -53 — 6y
0
Here's the deal my friend, you are actually requesting a script right now. This website dosen't alow you to do that. Darkcraft10 20 — 6y

Closed as Not Constructive by M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
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)

This should work

0
Do I put this in script and put it in a brick? madlyholland -53 — 6y
0
Yes MageMasterHD 261 — 6y
0
Ok thank you madlyholland -53 — 6y
0
np MageMasterHD 261 — 6y
View all comments (2 more)
0
magemasterhd it didn't work madlyholland -53 — 6y
0
what is the error MageMasterHD 261 — 6y
Ad