Hey, I’m very VERY sorry for sending so many DevForum posts, but, don’t blame me for being a buggy scripting lol.
So, I made a guis mode for my aim training game (for mobile users) and when I click a target, it clicks the target and clicks the background (which you are not supposed to click). Can somebody possibly tell me why this is happening? I tried to increase the ZIndex for the target gui, still doesn’t work. Heres the code:
game.ReplicatedStorage.OnClick.Event:Connect(function(gui)
if started then
totalParts += 1
gui:Destroy()
script.Parent.MainGui.Hit:Play()
local x, y = math.random(1, 9), math.random(1, 9)
print(x / 10, y / 10)
points += 20
accuracy += 1
displayPoints()
displayAccuracy()
createNewPart(UDim2.new(x / 10, 0, y / 10, 0)) -- Creates a new gui
end
end)
script.Parent.MainGui.Holder.InputEnded:Connect(function(input)
if started then
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
totalParts += 1
points -= 20
displayPoints()
displayAccuracy()
script.Parent.MainGui.DidNotHit:Play()
end
end
end)
Hope you can help ._.