I am trying to write a script that makes a certain wall disappear when hit by a rolling sphere. First, I wrote this script, which basically spawns the ball in a folder, names it, positions, shapes, and changes its size.
local debounce = false
local function SpawnBall()
if not debounce then
debounce = true
if game.Workspace.spherefolder:FindFirstChildOfClass("Part") then
game.Workspace.spherefolder:FindFirstChildOfClass("Part"):Destroy()
end
local rollingsphere = Instance.new("Part")
rollingsphere.Name = "RollingSphereBall"
rollingsphere.Parent = game.Workspace.spherefolder
rollingsphere.Position = Vector3.new(-0.399, 19.351, -17.6)
rollingsphere.Shape = Enum.PartType.Ball
rollingsphere.Size = Vector3.new(4, 4, 4)
wait(3)
debounce = false
end
end
game.Workspace.ballregenpart.Touched:Connect(SpawnBall)
But now, I wrote this script, and I want it to be so that when RollingSphereBall (part) touches blockingball (part), then blockingball (part) disappears. I wrote this script but it doesn’t seem to work.
script.Parent.Touched:Connect(function(hit)
if hit.Name = "RollingSphereBall" then
script.Parent.CanCollide = false
script.Parent.Transparency = 0.7
wait(1.5)
script.Parent.CanCollide = true
script.Parent.Transparency = 0
end
end)
this script doesn’t make the wall walkthrough for the 1.5 sec. I made a separate script for both of these, and put them both in workspace, please help!