local platform = script.Parent local function disappear() platform.BrickColor = BrickColor.Red() wait(1) platform:Destroy() end platform.Touched:Connect(disappear)
here's a way to type the script if you don't want the wait time: script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then script.Parent.Transparency = 1 script.Parent.CanCollide = false end end)
Heres a script to make it disapear when touched and make it comeback! script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then script.Parent.Transparency = 1 script.Parent.CanCollide = false task.wait(1) script.Parent.Transparency = 0 script.Parent.CanCollide = true end end)
This is better: -- Script Name: DeleteOnTouch -- This script deletes the part when it is touched local part = script.Parent -- Ensure the script is attached to a Part instance if part:IsA("Part") then part.Touched:Connect(function(hit) -- Check if the hit object is a valid instance if hit and hit.Parent then part:Destroy() end end) end
Just a question, how do I make it that the part only disappears for the person that touched it? I tried using a local script but it didnt work. Pls help me.
--Copy and Paste this instead of typing in the whole script lol local Part = script.Parent local function destroy() wait(1) Part:Destroy() end Part.Touched:Connect(destroy)
@@user-zm3dp4ip8t part.Touched:Connect(function(hit) h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then ..... Code basically is just checking to see if the thing that hit it was a humanoid, and if it is a humanoid then it fires the code underneath lol.