Any script I did is not working from now

I was trying to do some GUI animation for my game, and I had already an old animation and it was working really fine, until somewhy just stopped working but i didn’t change anything.

I have two scripts, the new one and the old, which i had 100% that it was working.

New:

local UI = script.Parent.Parent.Parent:FindFirstChild("Voting")
local Tween = game:GetService("TweenService")

local Info = TweenInfo.new(.75, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local Fast = TweenInfo.new(.25, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

-- Map Section

-- Provavelmente você vai ter que alterar bastante coisa aqui pra funcionar,
-- mas como eu só tô fazendo a animação, vou utilizar o que já está disponivel dentro do frame.

function ButtonClick(WhichOne)
	print("ButtonClick", WhichOne.Name)
	Tween:Create(WhichOne, Info, { Position = UDim2.new(0.101, 0,1.523, 0) }):Play()
	Tween:Create(WhichOne.UIStroke, Info, { Transparency = 0 }):Play()

	for _, v in pairs(UI.Maps.Maps:GetChildren()) do
		if v ~= WhichOne then
			Tween:Create(v, Fast, { ImageTransparency = 1 }):Play()
		end
	end
end


UI.Buttons.Maps.Map1.MouseButton1Click:Connect(function()
	print("Map1 clicked")
	ButtonClick(UI.Buttons.Maps.Map1)
end)

UI.Buttons.Maps.Centermap.MouseButton1Click:Connect(function()
	print("Centermap clicked")
	ButtonClick(UI.Buttons.Maps.Centermap)
end)

UI.Buttons.Maps.Map3.MouseButton1Click:Connect(function()
	print("Map3 clicked")
	ButtonClick(UI.Buttons.Maps.Map3)
end)

print("Script loaded")

Old:

local VotingUI = script.Parent.Parent.Parent.Voting

local Anim = require(game:GetService("ReplicatedStorage").GuiAnimations)
local Tween = game:GetService("TweenService")

local FadeOut = TweenInfo.new(.25, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

local CanClick = true

function AnimationMain(UI, CurrentPOS)
	CanClick = false
	Tween:Create(UI, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), { Position = UDim2.new(0.502, 0, 0.499, 0)}):Play()
	Tween:Create(UI.UIStroke, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), { Transparency = 0 }):Play()
	Tween:Create(UI.SelectedText, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), { TextTransparency = .6 }):Play()
	
	wait(3)
	GamemodesAnim()
end

function GamemodesAnim(UI, CurrentPOS)
	
end

-- Maps
VotingUI.Buttons.Maps.Map1.MouseButton1Click:Connect(function()
	if CanClick == true then
		local ClickedUI = VotingUI.Buttons.Maps.Map1
	local CurrentPos = ClickedUI.Position
		
	Tween:Create(VotingUI.Maps.Centermap, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), { Position = CurrentPos}):Play()
		VotingUI.Buttons.Maps.Centermap:TweenSize(UDim2.new(0.251, 0,0.776, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
		VotingUI.Buttons.Maps.Map3:TweenSize(UDim2.new(0.251, 0,0.776, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
		Tween:Create(VotingUI.Buttons.Maps.Map3, FadeOut, { ImageTransparency = .75 }):Play()
		Tween:Create(VotingUI.Buttons.Maps.Centermap, FadeOut, { ImageTransparency = .75 }):Play()
		
	AnimationMain(ClickedUI, CurrentPos)
		end
end)

VotingUI.Buttons.Maps.Centermap.MouseButton1Click:Connect(function()
	if CanClick == true then
		local ClickedUI = VotingUI.Buttons.Centermap
		local CurrentPos = ClickedUI.Position
		
		VotingUI.Buttons.Maps.Map1:TweenSize(UDim2.new(0.251, 0,0.776, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
		VotingUI.Buttons.Maps.Map3:TweenSize(UDim2.new(0.251, 0,0.776, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
		Tween:Create(VotingUI.Buttons.Maps.Map3, FadeOut, { ImageTransparency = .75 }):Play()
		Tween:Create(VotingUI.Buttons.Maps.Map1, FadeOut, { ImageTransparency = .75 }):Play()
		
	AnimationMain(ClickedUI, CurrentPos)
	end
end)

VotingUI.Buttons.Maps.Map3.MouseButton1Click:Connect(function()
	if CanClick == true then
		local ClickedUI = VotingUI.Buttons.Maps.Map3
		local CurrentPos = ClickedUI.Position
		
		Tween:Create(VotingUI.Maps.Centermap, TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), { Position = CurrentPos}):Play()
		VotingUI.Buttons.Maps.Map1:TweenSize(UDim2.new(0.251, 0,0.776, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
		VotingUI.Buttons.Maps.Centermap:TweenSize(UDim2.new(0.251, 0,0.776, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .25, true)
		Tween:Create(VotingUI.Buttons.Maps.Map1, FadeOut, { ImageTransparency = .75 }):Play()
		Tween:Create(VotingUI.Buttons.Maps.Centermap, FadeOut, { ImageTransparency = .75 }):Play()
		
		
		AnimationMain(ClickedUI, CurrentPos)
	end
end)

-- Gamemodes

The old one was just disabled, and when I test him just for sure that isn’t Roblox, it didn’t worked somewhy, there’s some proof of him working.

Just for more information, there’s the explorer >
image
The old and new script is located right there.

image
The UI.

Are there any errors in the console?

Also in the new one, I recommend changing:
local UI = script.Parent.Parent.Parent:FindFirstChild("Voting")
to
local UI = script.Parent.Parent.Parent:WaitForChild("Voting")
(Using WaitForChild is better)

Any at all!
The only thing that I got is from another script that don’t have any relation to this one.

And yeah, I already tried :WaitForChild(""), FindFirstChild("") just for make sure that isn’t the GUI that was not being encountered.

Did you click on a button? I don’t see anything being printed?
image

Yup. I did, but nothing shows up. Even with the old one.

I recommend adding WaitForChild for these as well,
image

Also, try adding a print at the first line and print something random just to see if it works.

I added print() for everything.
image
It printed everything, lol.

I also added WaitForChild("") for everything, but I still get nothing

print("Script tried to load")

local UI = script.Parent.Parent.Parent:WaitForChild("Voting")
local Tween = game:GetService("TweenService")
print("Script loaded Local.")

local Info = TweenInfo.new(.75, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local Fast = TweenInfo.new(.25, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
print("Script loaded TweenInfos.")

-- Map Section

-- Provavelmente você vai ter que alterar bastante coisa aqui pra funcionar,
-- mas como eu só tô fazendo a animação, vou utilizar o que já está disponivel dentro do frame.

function ButtonClick(WhichOne)
	print("ButtonClick", WhichOne.Name)
	Tween:Create(WhichOne, Info, { Position = UDim2.new(0.101, 0,1.523, 0) }):Play()
	Tween:Create(WhichOne.UIStroke, Info, { Transparency = 0 }):Play()

	for _, v in pairs(UI.Maps.Maps:GetChildren()) do
		if v ~= WhichOne then
			Tween:Create(v, Fast, { ImageTransparency = 1 }):Play()
		end
	end
end
print("Script loaded Animation Function.")

UI.Buttons.Maps:WaitForChild("Map1").MouseButton1Click:Connect(function()
	print("Map1 clicked")
	ButtonClick(UI.Buttons.Maps:WaitForChild("Map1"))
end)

print("Script loaded first Mouse1")

UI.Buttons.Maps:WaitForChild("Centermap").MouseButton1Click:Connect(function()
	print("Centermap clicked")
	ButtonClick(UI.Buttons.Maps:WaitForChild("Centermap"))
end)

print("Script loaded second Mouse1")

UI.Buttons.Maps:WaitForChild("Map3").MouseButton1Click:Connect(function()
	print("Map3 clicked")
	ButtonClick(UI.Buttons.Maps:WaitForChild("Map3"))
end)
print("Script loaded third Mouse1")


print("Script loaded")

I recommend adding WaitForChild’s to these as well.
image

Basically, UI:WaitForChild("Buttons"):WaitForChild("Maps"):WaitForChild("Map3")

Jeez! Looks very bright.

But I still get a no-no.

The output.

I also added WaitForChild("") to this part:


But yeah no effect at all.

I think I know the problem,
image


They have different names, I recommend changing them to the same ones.

Where exactly? I can’t see where is it at all.
I can also drop a file to the GUI if you’re available to make any changes to the script in-game.

Sure, send the file (I’ll try to dig deeper)

Here is it! Take a look
Problem.rbxl (53,0,KB)

I found the problem, the buttons are hidden behind the gamemode button, just change the zIndex of the maps button’s to something higher, or hide the gamemode buttons.

1 Like

:man_facepalming: - I can’t belive that it was just a simple thing…
Thank you so much for your patience, lol. :yellow_heart:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.