Hey guys I’m new to scripting so I’m a HUGE newbie when it comes to this profession but I’m learning so you’ll be seeing me a bunch of times on this topic. Anyways so I was wondering while I was just messing around trying to make a code that I learned from a few videos making a part unanchored after a player touches it. I managed to get the script to workout how I wanted it to be sort of but I was wondering why is it that I needed to change the line to. Also the first image is the code that is working but the second image is what wasn’t working.
local isTouched = false
local function fade()
if not isTouched then
isTouched = true
for count = 1, 10 do
platform.Transparency = count / 10
wait(0.1)
end
platform.CanCollide = false
wait(3)
platform.CanCollide = true
platform.Transparency = 0
isTouched = false
end
end
platform.Touched:Connect(fade)
But I believe this is the script you are trying to make
function onHit(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
script.Parent.Anchored = false
task.wait(1)
debounce = false
end
end
script.Parent.Touched:connect(onHit)
Let me know if you find any errors. I just made this up so it might not work