You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I’m trying to get 1 child from :GetChildren()
-
What is the issue? I can’t figure out how i can get 1 since everytime i try it gets multiple
-
What solutions have you tried so far? I’ve looked almost everywhere and i can’t seem to find a fix.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local enabled = true
local checking = false
while task.wait(math.random(5,14)) do
if math.random(1,10) ~= 10 then
for _, v in pairs(script.Parent:GetChildren()) do
if checking == false then
if v.Name ~= "GoldenSlapple" and v.Name ~= "Ground" then
checking = true
enabled = true
local glove = v
v.Glove.Transparency = 0
v.HandleLight.Transparency = 0
v.Glove.PointLight.Enabled = true
for _, a in pairs(v:GetChildren()) do
if a:IsA("Texture") then
a.Transparency = .1
end
end
checking = false
v.Glove.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and enabled == true then
game:GetService("Players"):FindFirstChild(hit.Parent.Name).leaderstats.Slaps.Value += math.random(1,10)
enabled = false
v.Glove.Transparency = 1
v.HandleLight.Transparency = 1
v.Glove.PointLight.Enabled = false
v.Sound:Play()
for _, a in pairs(v:GetChildren()) do
if a:IsA("Texture") then
a.Transparency = 1
end
end
end
end)
end
end
end
else
for _, v in pairs(script.Parent:GetChildren()) do
if v.Name ~= "Slapple" and v.Name ~= "Ground" then
enabled = true
local glove = v
v.Glove.Transparency = 0
v.HandleLight.Transparency = 0
v.Glove.PointLight.Enabled = true
v.Attachment.Flare.Enabled = true
for _, a in pairs(v:GetChildren()) do
if a:IsA("Texture") then
a.Transparency = .1
end
end
v.Glove.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and enabled == true then
game:GetService("Players"):FindFirstChild(hit.Parent.Name).leaderstats.Slaps.Value += math.random(50,100)
enabled = false
v.Glove.Transparency = 1
v.HandleLight.Transparency = 1
v.Glove.PointLight.Enabled = false
v.Attachment.Flare.Enabled = false
v.Sound:Play()
for _, a in pairs(v:GetChildren()) do
if a:IsA("Texture") then
a.Transparency = 1
end
end
end
end)
end
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.