Ok, first of all for the transparency you can use the for loop which WOULD look like THIS in YOUR case c;
non generic for pairs need 2 arguments and the 3rd is optional.
A) Beginning number for loop
B) End number of loop
C) "Optional" how much it will add to i by every loop
In your case you do need c because otherwise it will be 1 by default.
oh and you need to DEFINE the LOCATION but I'll show you that soon.
for i = 0, 1, .25 do
GUI.Transparency = 1 - i
wait(.25)
end
Then you would need it to wait 4 seconds in your case and reverse it
wait(4)
for i = 0, 1, .25 do
GUI.Transparency = i
wait(.25)
end
We will do the wait 60 of this afterwards.
Now you need the function of when this is touched
function SetTransGUI(part)
end
the part parameter because when you touch a brick a parameter is passed in called "part" meaning the part that touched it.
Oh and this is phenomenon in which the ontouch is activated ALOT so you need to add a varaible that wont allow it to run again WHILE its running
local debounce = true
function SetTransGUI(part)
if debounce then
debounce = false
end
end
Now heres the part when we acces the players GUI
now we will need to verify first if the touched part is a PLAYER
local debounce = true
function SetTransGUI(part)
if debounce then
local human = part.Parent:findFirstChild("Humanoid")
if human then
debounce = false
end
end
Now afterwards this is the CHARACTER. We need to get inside its player GUI.
Now heres the part when you use a method called GetPlayerFromCharacter(character)
local debounce = true
function SetTransGUI(part)
if debounce then
local human = part.Parent:findFirstChild("Humanoid")
if human then
debounce = false
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
end
end
Before we go ahead lets create a seperate function that takes the location and does the fade in and out
function FadeInOut(GUI)
for i = 0, 1, .25 do
GUI.BackgroundTransparency = 1 - i
wait(.25)
end
wait(4)
for i = 0, 1, .25 do
GUI.BackgroundTransparency = i
wait(.25)
end
end
Now we call it in the other script
local debounce = true
function SetTransGUI(part)
if debounce then
local human = part.Parent:findFirstChild("Humanoid")
if human then
debounce = false
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
FadeInOut(plr.PlayerGui.ScreenGui.Frame)
end
end
Now we add the wait 60 so its unusable until 60 seconds
local debounce = true
function SetTransGUI(part)
if debounce then
local human = part.Parent:findFirstChild("Humanoid")
if human then
debounce = false
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
FadeInOut(plr.PlayerGui.ScreenGui.Frame)
wait(60)
debounce = true
end
end
end
Now the part when you call this when this the parent of this script is touched
script.Parent.Touched:connect(SetTransGUI)
Now we put it all together.
local debounce = true
function FadeInOut(GUI)
for i = 0, 1, .25 do
GUI.BackgroundTransparency = 1 - i
wait(.25)
end
wait(4)
for i = 0, 1, .25 do
GUI.BackgroundTransparency = i
wait(.25)
end
end
function SetTransGUI(part)
if debounce then
local human = part.Parent:findFirstChild("Humanoid")
if human then
debounce = false
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
FadeInOut(plr.PlayerGui.ScreenGui.Frame)
wait(60)
debounce = true
end
end
end
script.Parent.Touched:connect(SetTransGUI)
And this would work but you would have to change the parameter of when you call the FadeInOut.
AND I CAME UP WITH THIS FROM THE TOP OF MY HEAD AND WHEN I TESTED IT WORKED ON TEH FIRST TRY >:D
+9001 c;
3 comments
So are those last 12 lines the ones I need to put in the script?
And the script goes in the part that you touch, also where of screen is it, will it then slide on to the screen?
To slide into the screen you'd use http://wiki.roblox.com/index.php?title=Tweening