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

How do I make it so when the player touch the brick their sword get remove? [closed]

Asked by 6 years ago

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

0
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. Darkcraft10 20 — 6y

Closed as Not Constructive by User#19524

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

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

0
if it does not work please tell me the error message MageMasterHD 261 — 6y
0
Is it a local script? Darkcraft10 20 — 6y
0
nope MageMasterHD 261 — 6y
0
*facepalm* DeceptiveCaster 3761 — 6y
View all comments (10 more)
0
I believe thats the problem. Darkcraft10 20 — 6y
0
This is a server script placed in the brick that should delete the sword MageMasterHD 261 — 6y
0
it's supposed to be local DeceptiveCaster 3761 — 6y
0
I tried it and it worked MageMasterHD 261 — 6y
0
Copy the script, pase it into a local script inside the brick. Darkcraft10 20 — 6y
0
not server-wide DeceptiveCaster 3761 — 6y
0
But it works MageMasterHD 261 — 6y
0
server-wide would lag the game DeceptiveCaster 3761 — 6y
0
@Darkcraft10 If you just put the script into a local script it doesnt work anymore MageMasterHD 261 — 6y
0
thank you madlyholland -53 — 6y
Ad