Hello, In my game Sword Battle Simulator I am also trying to make a frame fade to BackgroundTransparency + 0 to BackgroundTransparency + 1 after an animation plays after a player dies in Sword Battle Simulator. Can anyone show me how to script this?
You would use a numeric for loop for this. Here is an article that discusses it. An example usage would be:
for i = 1,0,-0.1 do
gui.BackgroundTransparency = i
wait()
end
All you would need to do is connect a function to the humanoid’s .Died
event, and use a for loop (or tween) to fade the transparency of the frame to whatever you want (whenever it happens).
You can make the Gui that the frame is parented to reset on spawn by changing its property, and automatically fade the frame out at the start of the script (if they have already died).
Resources you might want to research:
Humanoid.Died
from the dev wiki-
Numeric For from PiL,
exp
means number in this context, and looks very confusing…
No, because that’s not the purpose of this category.
Here, take a look at TweenService. You will also need to look at Humanoid.Died. The rest, think about what you might require and then perform some searches on the DevForum or Developer Hub for what you think you might need.
Create a ScreenGui with a Frame in it, then have a LocalScript handle it. When the player dies (Humanoid.Died fires), create a tween on the frame to fade its transparency as you need (from 0 to 1 or vice versa). That’s really it.
There are code samples on various articles on the Developer Hub and around the forum.
Ok I will look at that in a few weeks thanks!
And I don’t mean like show me how to script it, I mean if someone can give me ideas. That’s what I mean by “can anyone show me how to script this?”