??? What the heck am i doing wrong??
It won’t even print(“Ok”)
local player = game.Players.LocalPlayer
local leaderstats1 = player.leaderstats.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.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.Activated: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)
Could be, you dont have any error output?
Any of these variables could stop the script if any of those doesnt exist before the script is trying to reach them:
local leaderstats1 = player.leaderstats.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 trigger = game.ReplicatedStorage.TropicalEggdog
Check output and use WaitForChild() on all of them
A little improvement you should try is to define variables instead of using those “ladders” of .Paren.Parent.Parent... To make it easy to not get confused while referencing them
local MainGUI = script.Parent.Parent.Parent
local four = MainGUI:WaitForChild("Three")
I removed the waitforchild because I thought the script was looping over one forever
(Still don’t think it’s waitforchild, since the problem im facing is these two here
Print doesn’t print.)
The issue are not those lines.
Simply the script is not reaching those lines, so, theres no function connected to the button.
If you said that you removed the WaitForChild() cause it was looping forever, probably theres an instance in there that doesnt exist, and WaitForChild was waiting for it to exist. If you remove it the problem is not fixed, cause the instance still not existing
local player = game.Players.LocalPlayer
local leaderstats1 = player.leaderstats.Eggcoins
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.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.Activated: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)
You just removed one of the variables?
Why not debugging and canceling all the code that is not needed so you can test if the buttons actually works or not? Most of the code is useless if you want to test if the buttons works
local player = game.Players.LocalPlayer
--[[
local leaderstats1 = player.leaderstats.Eggcoins
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 trigger = game.ReplicatedStorage.TropicalEggdog
]]
local MaxEggdog = 1
if MaxEggdog > 1 then
--four.Text = "You can't buy more than one skin!"
--copy tween service here
end
local db = false
script.Parent.Activated: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)
Yup the issue was an Instance not existing when the script is trying to reach it.
Thats why using WaitForChild() is useful, so the code below actually run and script wont stop.
And make sure the references you are working with actually exist in game/player etc.