-
What do you want to achieve? I want to make so when the parts touching each other they are instancing an explosion in their position.
-
What is the issue? When the parts are touching each other they’re are not instancing an explosion and nothing is writing in output.
-
What solutions have you tried so far? I tried differently edition of codes but I think it is because of the “end”
local part = script.Parent
function lol()
for i = 1,3 do
local parts = Instance.new("Part",game.Workspace)
parts.Position = Vector3.new(-math.random(1,50),math.random(0.1,3),math.random(1,80))
parts.Anchored = true
parts.Name = "NewParter"
parts.Size = Vector3.new(5,5,5)
parts.Shape = Enum.PartType.Ball
parts.Color = Color3.fromRGB(255, 157, 37)
parts.Material = Enum.Material.Cobblestone
local TweenService = game:GetService("TweenService")
local TweenInfo1 = TweenInfo.new(6)
local Goal = {}
Goal.Position = Vector3.new(-10, 50, 58.6)
local Tween = TweenService:Create(parts, TweenInfo1, Goal)
Tween:Play()
parts.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("NewParter") then
local exp = Instance.new("Explosion",parts)
exp.Position = parts.Position
end
end)
end
end
script.Parent.ClickDetector.MouseClick:Connect(lol)
Note: I know it is simple to make parts to an instance explosion but the problem is that it is not working and I think it is because of the end I guess I need to put the “end)” in the back but I can’t because it is typing “unknown global” I tried to return function but didn’t work.