The gui button labelled “yes” won’t let anything happen when I click it (a.k.a. Print(“Ok”) Wont work.
local player = game.Players.LocalPlayer
local character = player.Character:WaitForChild("Humanoid")
local leaderstats1 = player:FindFirstChild("leaderstats"):WaitForChild("EggCoins")
local leaderstats2 = game.ReplicatedStorage.w1
local button2 = script.Parent.Parent.Parent.Three.TextLabel
local three = script.Parent.Parent
local four = script.Parent.Parent.Parent.Three.TextLabel
local originalposition = script.Parent.Parent.Position
local MaxEggdog = 1
local trigger = game.ReplicatedStorage:WaitForChild("TropicalEggdog")
if MaxEggdog > 1 then
four.Text = "You can't buy more than one skin!"
--copy tween service here
end
local db = false
script.Parent.MouseButton1Click:Connect(function()
print("Ok")
if leaderstats1.Value >= 150 then
print("2")
--[[leaderstats2.Value = true
button.Sound:Play()
leaderstats.Value -= 150
trigger:FireServer()
MaxEggdog += 1
script.Parent.Parent.Parent.Enabled = false ]]
script.Parent.Sound:Play()
print("3")
local Info = TweenInfo.new(1.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local ts = game:GetService("TweenService")
if not db then
print("4")
db = true
three:TweenSizeAndPosition(
UDim2.new(0.9, 0,0.9, 0), -- size
UDim2.new(0.07, 0,-0.1, 0), -- pos
Enum.EasingDirection.Out, --easing dir
Enum.EasingStyle.Sine, --easing styl
1.25,
true
)
print("5")
four:TweenPosition(
UDim2.new(0.25, 0,0.85, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
1.25,
true
)
print("6")
wait(3.5)
print("7")
three:TweenSizeAndPosition(
UDim2.new(1, 0,1, 0), -- size
UDim2.new(0, 0,0, 0), -- pos
Enum.EasingDirection.Out, --easing dir
Enum.EasingStyle.Sine, --easing styl
1.25,
true
)
print("8")
four:TweenPosition(
UDim2.new(0.25, 0,1.5, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
1.25,
true
)
print("9")
db = false
print("10")
end
end
end)
If you’re on mobile, .MouseButton1Click wont work, so perhaps you should use .Activated, that way, this will detect presses for both PC and mobile.
Set the Active property of the button to true, that way it allows to fire events such as button clicks and hover ons.
Check for the Zindex property, some GUI objects might be overlaying the button and you don’t even know it. It might cause some trouble.
I’m not sure where your script is located but make sure it’s located in somewhere like StarterGui (or in it’s descendants), ReplicatedFirst or StarterPlayerScripts.
There’s no such event, there are only three events in my knowledge, to detect GUI button clicks: .MouseButton1Click, .MouseButton2Click and .Activated.
It does work on both platforms, so that can’t be the problem. Are you sure that part of the script is running? Maybe the execution got stuck at one of your :WaitForChild() at the beggining of the script, and it’s waiting for something that doesn’t exist.
Is there any infinite yield warning at console?
I could be wrong, but I would try deleting the button and completely remake the button. It could be from very annoying bug (I think it’s a bug) I’ve been encountering recently. The button won’t work, but after deleting it and recreating it, the new one works just fine.
I don’t know if this is your issue, but I would try it.