hello i am trying to make a touch event fire but when part touches something it doesn’t fire the event
local sun = game.ReplicatedStorage.innerlayer
local copy = sun:Clone()
copy.Parent = workspace
local value = script.Parent.Value.Value.Position
local tweenservice = game:GetService("TweenService")
local field = workspace.field
while true do
local instances = script.Parent:GetChildren()
wait(5)
local randomChild = instances[math.random(#instances)]
value = randomChild
copy.Position = Vector3.new(value)
end
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad)
local tween1 = tweenservice:Create(copy,tweenInfo,{Transparency = 1})
local tween2 = tweenservice:Create(copy,tweenInfo,{Transparency = 0.7})
function Ground(hit)
print(hit) -- to debug it
print("touched")
copy.Anchored = true
wait(5)
tween1:Play()
wait(1)
tween2:Play()
end
copy.Touched:Connect(Ground)
for me i did a second Clone here’s the code (it’s placed in workspace as a server sided script)
local sun = game.ReplicatedStorage.innerlayer
local copy = sun:Clone()
copy.Parent = game.Workspace
local tweenservice = game:GetService("TweenService")
copy.Anchored = true
copy.Transparency = 1
local debris = game:GetService("Debris")
while true do
local clone = copy:clone()
clone.Transparency = 0.2
clone.Anchored = false
clone.Parent = game.Workspace
local randompos1 = math.random(-15.2,-0.2)
local randompos2 = math.random(0.2,36.2)
clone.Position = Vector3.new(randompos1,20,randompos2)
debris:AddItem(clone,8)
local tweenInfo = TweenInfo.new(1)
local tween1 = tweenservice:Create(clone,tweenInfo,{Transparency = 1})
local tween2 = tweenservice:Create(clone,tweenInfo,{Transparency = 0.7})
wait(6)
tween1:Play()
wait(1)
tween2:Play()
wait(1)
tween1:Play()
function Ground(hit)
if hit.name ~= "innerlayer" then
print(hit) -- to debug it
print("touched")
clone.Anchored = true
end
end
wait(2)
clone.Touched:Connect(Ground)
print(clone.Position)
wait(2)
end