Hi there! I’m new to the scripting community, and only have developed a currency system, as well as a transition system when teleporting a player.
However, there is something that’s bothering me whenever I playtest.
You see, whenever I playtest, I added a respawn function into the game to refresh a player’s inventory and to put them on a different team. That way, the player doesn’t have access to their tools or items from gamepasses UNTIL they actually start playing it. I also have a little mini death GUI function inside of it, to where if the player dies, there’ll be a death screen.
That being said… Every time I respawn, the death screen just goes wonky- like crazy. Is there a way to implement a transition that’s smooth when the player is respawning? I’ve tried all that I could, but I ended up being stumped. Am I supposed to add a remote event? I’d like to be guided in the right direction. Bonus points if you can provide a script example, and tell me where to put it.
Do you have the image of the death screen that we can have a look at? The “transition that’s smooth when the player is respawning” do you mean by maybe tweening from the death screen to the player’s position…? I don’t quite get what you mean.
I’ll try to get some footage of it when I can, thanks for the quick reply! But to clarify before I try to start recording it, imagine flashing red lights every time you respawn. That’s what I mean.
local PrimaryFrame = script.Parent
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
TweenService:Create(PrimaryFrame,TweenInfo.new(2),{BackgroundTransparency = 1}):Play() -- becomes invisible on respawn
humanoid.Died:Connect(function() -- plays on death
TweenService:Create(PrimaryFrame,TweenInfo.new(2),{BackgroundTransparency = 0}):Play()
end)
This should be placed inside the character, otherwise the script will run only once, while in character will run every time the character respawns/loads