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

How do you make a character transparency of 0.98 GUI?

First of all, I can barley read scripts. I just need the script and directions (if any). I have a working Image Button GUI in starter GUI. When you click it, I want everything that the player can control (so it works with my morphs) to go to a transparency of 0.98 using R16. When you click it again, everything should go back to its previous transparency (Instead of transparency of 0 due to the fact that some of my morphs have transparent parts on them. Feel free to ask any questions. Thanks.

2 comments

0

Sorry for the specific title, the website was forcing me to make it a certain amount of characters in length.

0

All good, I answered it. You can check it out and tell me if you find any bugs

1 answer

To change everything in the characters transparency and save the old one, do the following steps:

  1. Create a remote event named "changeTableTransp" under replicated storage

  2. Create a local script under the Button

  3. Create a server script in server script service

IN THE LOCAL SCRIPT:

changeTableTransp = game:GetService("ReplicatedStorage"):WaitForChild("changeTableTransp")
plr = game.Players.LocalPlayer

local activated = false
local saveTable = {}
script.Parent.MouseButton1Click:Connect(function()
	if activated then
		activated = false
		changeTableTransp:FireServer(saveTable)
		saveTable = {}
	else
		activated = true
		local FireTable = {}
		for _,v in pairs(plr.Character:GetChildren()) do
			if v:IsA("Part") then
				local Tab = {}
				table.Insert(Tab,v.Name)
				table.Insert(Tab,v.Transparency)
				table.Insert(saveTable,Tab)
				local tab2 = {}
				table.Insert(Tab2,v.Name)
				table.Insert(Tab2,0.98)
				table.Insert(FireTable,Tab2)
			end
		end
		changeTableTransp:FireServer(FireTable)
	end
end)

IN THE SERVER SCRIPT:

changeTableTransp = game:GetService("ReplicatedStorage"):WaitForChild("changeTableTransp")

changeTableTransp.OnServerEvent:Connect(function(plr,table)
	local char = plr.Character
	if not char then warn("Character not found") return end
	for _,v in pairs(table) do
		for _, v2 in pairs(v) do
			local part = char:FindFirstChild(v2[1])
			if part then
				part.Transparency = v2[2]
			end
		end
	end
end)

If you run into any bugs with the code, feel free to tell me with the output error if there is one. I hope I was able to help you out. Happy scripting! ~mc3334

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