Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Check my script to see if anything is wrong with the frame. Any help?

So I'm getting frustrated on my script, its not working but there are not error even when i reload the script nothing is happening. I made a fading frame that I parented towards a gui, I made the frame that was inside the gui visible and change the background transparency with the help of a local script from another gui. I tried testing it and nothing was working, so if you could redo or fix the script it would be very thankful. ALSO DO NOT HATE ME FOR NOT USING LOOPS AS I TRIED THAT AND NOTHING HAPPENED

Also if you really really need more information then here is the game link: https://web.roblox.com/games/3171457814/Fred-bear-And-Friends-Family-Diner#!/about

Here is the script

local playergui = game.Players.LocalPlayer.PlayerGui
local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera
local PlayerGui = player.PlayerGui
local hum = character:WaitForChild("Humanoid")
local StarterGui = game:GetService("StarterGui")






local black = script.Parent.Parent.Parent.BlackFadingGui.Frame
local playergui = game.Players.LocalPlayer.PlayerGui
script.Parent.MouseButton1Click:Connect(function(player)
	
black.Parent = StarterGui.BlackFadingGui
	
	
	black.BackgroundTransparency = 0.1
    black.BackgroundTransparency = 0.2
	black.BackgroundTransparency = 0.3
	black.BackgroundTransparency = 0.4
	black.BackgroundTransparency = 0.5
	black.BackgroundTransparency = 0.6
	black.BackgroundTransparency = 0.7
	black.BackgroundTransparency = 0.8
	black.BackgroundTransparency = 0.9
	black.BackgroundTransparency = 1
    
	
	repeat wait(0.1)
		camera.CameraType = Enum.CameraType.Scriptable
	until camera.CameraType == Enum.CameraType.Scriptable
	
	camera.CFrame = workspace.CameraPosition2.CFrame
	script.Parent.Visible = false
	wait(0.1)
	  
	        
	        


	        

	  

	

	playergui.CharacterSelectionGui.Frame.Visible = true
	
	
	
      

end)


script.Parent.MouseEnter:Connect(function()
	script.Parent.BackgroundTransparency = .5
end)

script.Parent.MouseLeave:Connect(function()
	script.Parent.BackgroundTransparency = 1
end)


hum.Died:Connect(function()
	
    
	script.Parent.Visible = false
     wait(0.01)
	
	
	
	script.Parent.Visible = true
	wait(0.01)
	script.Parent.Visible = true
	end)

 

1 answer

✓ Accepted answer

Your problem is here:

black.BackgroundTransparency = 0.1
black.BackgroundTransparency = 0.2
black.BackgroundTransparency = 0.3
black.BackgroundTransparency = 0.4
black.BackgroundTransparency = 0.5
black.BackgroundTransparency = 0.6
black.BackgroundTransparency = 0.7
black.BackgroundTransparency = 0.8
black.BackgroundTransparency = 0.9
black.BackgroundTransparency = 1

To us it might seem like it works but the script actually does this so fast that you see it as instant. To fix this, you need to do a for loop and a wait.. Though you could just put wait(0.1) in between those lines but a better way to do it is like this:

for i = 1, 10 do
	black.BackgroundTransparency = black.BackgroundTransparency + 0.1
	wait(0.1)
end

4 comments

0

Oh ok bcuz i was wondering why it was not showing any frame.

0

Its still not working its not showing the frame

0

Check if it's enabled and stuff. Did you put it in the correct place? Did you try clicking? I have a feeling one of your variables is causing the problem.

0

See i don't really know and that is why i am asking you guys

This discussion is preserved as it was. New answers, comments, and votes are closed.