So i had a question from before and I 'm trying my best to get this script fixed but nothing works :(, it almost seems hopeless, I clicked around and tried deleting some variables, nothing worked, if there are any good developers who could script could really do me a favor. Here is the script
Also if you guys are wondering what I'm trying to do here is my game link: roblox.com/games/3171457814/Fred-bear-And-Friends-Family-Diner#!/about
local player = game.Players.LocalPlayer local character = player.Character local camera = workspace.CurrentCamera 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 for i = 1,10 do black.BackgroundTransparency = black.BackgroundTransparency + 0.3 wait(0.1) end 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) wait(0.01) 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)
It doesn't seem as if you're using the for loop the correct way, I'll guide you through this.
for i = startingNum, endingNum, incrementBy do -- startingNum defines the number to start at -- endingNum defines the number to stop at -- increment defines the increment of the loop, the number can be positive or negative end
As it seems that you want to make your frame disappear you'd have to decrease the transparency Here's a core example
-- >> Variables local player = game.Players.LocalPlayer local character = player.Character local camera = workspace.CurrentCamera local hum = character:WaitForChild("Humanoid") local black = script.Parent.Parent.Parent.BlackFadingGui.Frame local playergui = game.Players.LocalPlayer.PlayerGui script.Parent.MouseButton1Click:Connect(function(player) black.Parent = plr:WaitForChild("PlayerGui").BlackFadingGui -- >> Functioning for i = 0, 1, 0.1 do black.Transparency = i -- ensure that you set your iteration so that it will increase/decrease wait(0.1) -- so essentially the way this script works is that, it'll start by 0, and by every .1 of a second, itll fade to one. so it goes 0, .1, .2, .3, .4, .5 and so on end
I advise you to use TweenService other than for I Loop, for multiple reasons.
https://developer.roblox.com/en-us/api-reference/class/TweenService