Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make changed text stay after the charecter dies/respawns? This script is in part.

script.Parent.Touched:Connect(function(plr)
	    if plr.Parent:IsA("Model") and game.Players:FindFirstChild(plr.Parent.Name) then
	        if game.Players:GetPlayerFromCharacter(plr.Parent) then
	            plr=game.Players:GetPlayerFromCharacter(plr.Parent)
	            plr.PlayerGui.Service.PortalsFrame.Winterland.Text = "Teleport"
	            plr.PlayerGui.Service.PortalsFrame.Winterland.BackgroundColor3 = Color3.fromRGB(62, 255, 33)
	        end
	    end
	end)

1 answer

✓ Accepted answer

If you don't plan to change the text back, you can make a permanent solution in the same script by editing the ui again everytime the player respawns.

As always, let me know if it works or if it is broken, yet again I can't test.

local players={}

script.Parent.Touched:Connect(function(plr)
	if plr.Parent:IsA("Model") and game.Players:FindFirstChild(plr.Parent.Name) then
		if game.Players:GetPlayerFromCharacter(plr.Parent) then
			plr=game.Players:GetPlayerFromCharacter(plr.Parent)
			if table.find(players,plr.Name) == nil then
				table.insert(players,plr.Name)
				plr.CharacterAdded:Connect(function()
					wait(0.25) -- You can try removing this wait line if you want, it's just me making sure it doesn't change too fast
					plr.PlayerGui.Service.PortalsFrame.Winterland.Text = "Teleport"
					plr.PlayerGui.Service.PortalsFrame.Winterland.BackgroundColor3 = Color3.fromRGB(62, 255, 33)
				end)
			elseif game.Players:FindFirstChild(plr.Name) == nil then
				table.remove(players,table.find(players,plr.Name))
			end
			plr.PlayerGui.Service.PortalsFrame.Winterland.Text = "Teleport"
			plr.PlayerGui.Service.PortalsFrame.Winterland.BackgroundColor3 = Color3.fromRGB(62, 255, 33)
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.