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

How could i add a script to an uncollidable wall that will remove ff? [closed]

Asked by 7 years ago

I have no idea where to start.

0
I'm assuming ff means force field. User#11440 120 — 7y

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?

2 answers

Log in to vote
0
Answered by 7 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Try putting this in your wall ;8 Hope it works.

function onTouched(hit)
    hit.Parent.ForceField:Destroy()
end

script.Parent.Touched:connect(onTouched)
0
What if the Force Field doesn't exist? This would throw you an error. User#11440 120 — 7y
Ad
Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

This is simple,

Let's start with the Touched Event,

script.Parent.Touched:connect(function(part)
    --Code later
end)
I'm using anonymous functions.

The touched event returns the part that touched whatever it's detecting.

Let's get the parent and look for a force field in the parent,

-- Regular Script
script.Parent.Touched:connect(function(part)
    if part.Parent:FindFirstChild("ForceField") then
        -- code later
    end
end)

Here's a link to a gif of what the Force Field looks like inside of the character,

Now that we know the Force Field exists, let's delete it,

-- Regular Script
script.Parent.Touched:connect(function(part)
    if part.Parent:FindFirstChild("ForceField") then
        part.Parent:FindFirstChild("ForceField"):Destroy()
    end
end)

And that's about all!

I Hope I Helped!

Good Luck!

If I did help, please don't forget to accept this answer! It helps a lot.