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

Making brick unanchor when hit with specific brick?

Asked by 9 years ago

I tried this code, but it doesn't work and I think it's wrong anyway.

f1=game.Workspace.f1
function hit(f1)
f1.Anchored=false
end
script.Parent.Touched:connect(hit)

I want it so that when this part hits a part named f1, the part named f1 unanchors. Any help?

1 answer

Log in to vote
2
Answered by 9 years ago

If you want to unanchor a part when hit with f1, you need a check to make hit see if it's "f1".

script.Parent.Touched:connect(function(hit)
    if hit.Name == "f1" then
        hit.Anchored = false
    end
end)
0
Tried that script, didn't work. Played with it a bit, didn't work. I am starting to wonder if this can even be done. TealTeam 40 — 9y
0
I works. I just did it wrong. Now try. TypicalModerator 110 — 9y
0
Yeah, I fixed that in my script... didn't work. Is it just me? Should I reinstall? TealTeam 40 — 9y
0
Is it exactly like what I put? It should work. --And I was typing fast before and I had other things in my mind so I completely failed it. TypicalModerator 110 — 9y
View all comments (17 more)
0
This script should work perfectly fine. TealTeam, there has to be something wrong with a different part of your script, so if you could, it would probably help Rethiux if you posted your entire script. dyler3 1510 — 9y
0
I can do more than that. Here's a video: https://www.youtube.com/watch?v=qKF4_GKpoZw&feature=youtu.be TealTeam 40 — 9y
0
For some reason, the video is taking forever... Anyways, it appears that it works when I change it to destroy everything it touches. It destroys me when I walk into the brick, but not the part! Maybe that will help. TealTeam 40 — 9y
0
I think the problem might be how you have that big brick moving towards it. The Touched event isn't firing correctly or something...Post your script thats making that brick move, and i'll see what I can do. dyler3 1510 — 9y
0
Where is the script located? TypicalModerator 110 — 9y
0
Its located inside the big red brick. The script making the brick move is TealTeam 40 — 9y
0
Ok, let me get this straight... If what part touches what, what get's unanchored? TypicalModerator 110 — 9y
0
while true do script.Parent.Position=script.Parent.Position+Vector3.new(0,0,.5) wait(.1) end TealTeam 40 — 9y
0
When the big moving red part touches that grey brick, the grey brick needs to unanchor. TealTeam 40 — 9y
0
The names of each part? Red = what grey = what? TypicalModerator 110 — 9y
0
Red is just Part, doesn't need a name. Grey is f1. TealTeam 40 — 9y
0
It doesn't work because it checks to see if it touches itself.... TypicalModerator 110 — 9y
0
Put the script in the RED brick and try. I edited it. DO NOT CHANGE. TypicalModerator 110 — 9y
0
How is it checking if its touching itself if its checking for f1? TealTeam 40 — 9y
0
No, the script is in the red one to check if it's touched Rethiux. It's fine that way. The Touched event isn't firing correctly. Anyways TealTeam, I'll post an answer, and try the script I provide in place of the other one that moves the brick. dyler3 1510 — 9y
0
No worky. Is it even possible to do this? TealTeam 40 — 9y
0
"This event does not fire if the part is being CFramed through something." Always check the wiki. Perci1 4988 — 9y
Ad

Answer this question