I recently created a game in which players can choose an RP avatar in the lobby game and are then teleported to the other game (the main game). One of the characters is causing me problems, however, namely the character called Ghost. This character has a body transparency of 0.75. The problem is that all other characters now also have a transparency of 0.75. I tried to write a script that if the player does not receive the teleport message: Ghost or no message in general, the body transparency is set to zero, but it doesn’t work at all. Can someone explain to me how I can write a script that works?
the script with which the player is teleported out of the lobby game
local TeleportService = game:GetService("TeleportService")
local PLACE_ID = 3763568
local function TeleportPlayerWithMorph(Player, Morph)
local TeleportOptions = Instance.new("TeleportOptions")
TeleportOptions:SetTeleportData({
["Morph"] = Morph,
})
TeleportService:TeleportAsync(PLACE_ID, {Player}, TeleportOptions)
end
TeleportPlayerWithMorph(Player, "Ghost")
So, the player is teleported out of the lobby game with a message (he is teleported out with the specified script, which also sends the Ghost message). Once in the main game, another script sets the transparency to 0.75 when the script receives the Ghost message. The problem here, however, is that the other players who joined the RP game with a different RP morph also assume the transparency of 0.75. I don’t know how to write a script that if a player doesn’t receive the Ghost message, the transparency is not set to 0.75 (players who don’t receive the Ghost message = transparency at 0
players who receive the Ghost message = transparency at 0.75)
I hope you were able to understand everything.
Well. Your setting the transparency to 0.75 no matter the morph. Add an if statement to ensure the morph is “Ghost”, and if not, do another elseif check for a different morph.
local InsertService = game:GetService("InsertService")
local AssetService = game:GetService("AssetService")
local Players = game:GetService("Players")
setTransparency(Character:FindFirstChild("Head"))
setTransparency(Character:FindFirstChild("UpperTorso"))
setTransparency(Character:FindFirstChild("LowerTorso"))
setTransparency(Character:FindFirstChild("LeftUpperArm"))
setTransparency(Character:FindFirstChild("LeftLowerArm"))
setTransparency(Character:FindFirstChild("LeftHand"))
setTransparency(Character:FindFirstChild("RightUpperArm"))
setTransparency(Character:FindFirstChild("RightLowerArm"))
setTransparency(Character:FindFirstChild("RightHand"))
setTransparency(Character:FindFirstChild("LeftUpperLeg"))
setTransparency(Character:FindFirstChild("LeftLowerLeg"))
setTransparency(Character:FindFirstChild("LeftFoot"))
setTransparency(Character:FindFirstChild("RightUpperLeg"))
setTransparency(Character:FindFirstChild("RightLowerLeg"))
setTransparency(Character:FindFirstChild("RightFoot"))
else
-- Additional elseif checks for other Morphs can be added here
if Morph == "AnotherMorph" then
-- Perform actions for "AnotherMorph"
end
end
end
end)
end)