Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My gui never fades no matter what I do, and what I try. Any help?

Asked by 4 years ago
Edited 4 years ago

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)

2 answers

Log in to vote
0
Answered by
0_2k 496 Moderation Voter
4 years ago
Edited 4 years ago

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
0
Still not working trickortreat333444 -6 — 4y
0
Ah, I realized the error. Fixed, you don't want to set the GUI to "StarterGui" as it is differentiated between that and "PlayerGui" 0_2k 496 — 4y
Ad
Log in to vote
1
Answered by 4 years ago

I advise you to use TweenService other than for I Loop, for multiple reasons.

https://developer.roblox.com/en-us/api-reference/class/TweenService

0
Agreed, I'd advise them to at least to seek into the way this works before passing them onto other things you know? 0_2k 496 — 4y
0
Ok but I'm making a "GUI" not a part trickortreat333444 -6 — 4y
0
Tweenservice works on guis too.... Grainless_Bread 132 — 4y

Answer this question