Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Image won't go at 0 transparency?

Asked by 4 years ago
Edited 4 years ago

https://gyazo.com/34fb2392f8a7fe5de60db616e7b74bc6 In this gif I first click on the purple logo, and then when I click on the red logo the purple logo is supposed to go at 0 transparency.

Here is the code:

local StartingScreen = script.Parent
local ParthiaButton = StartingScreen.MainFrame.Parthia
local player = game.Players.LocalPlayer
local TeamInform = StartingScreen.MainFrame.TeamInform
local RomeButton = StartingScreen.MainFrame.Rome
StartingScreen.Enabled = true

ParthiaButton.MouseButton1Click:Connect(function()
    print("Assigned team to Parthia")
    player.Team = game.Teams.Parthia
    ParthiaButton.ImageTransparency = 0.6
    TeamInform:TweenPosition(UDim2.new(0.4, 0,0.6, 0),"Out","Bounce",3)
    TeamInform.Text = "Your team is the Parthian Empire!"
    if player.Team == game.Teams.Rome then
        RomeButton.ImageTransparency = 0
    end
end)


RomeButton.MouseButton1Click:Connect(function()
    print("Assigned team to Rome")
    player.Team = game.Teams.Rome
    RomeButton.ImageTransparency = 0.6
    TeamInform:TweenPosition(UDim2.new(0.4, 0,0.6, 0),"Out","Bounce",3)
    TeamInform.Text = "Your team is the Roman Empire!"
    if player.Team == game.Teams.Parthia then
        ParthiaButton.ImageTransparency = 0
    end
end)


Here is the explorer https://gyazo.com/08a3ea82f08e1957fd5d5516caff9ea8

In the properties tab of the image transparency it doesn't change at all when I click on each logo. Does anyone know why?

(I had a third logo and it worked perfectly. I recently team shared and deleted the third logo. Every since I did it does not work. The output shows nothing also.)

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I Discovered the problem, You changed the team before checking if its team is the other team, So it wont detect if the other gui is transparent, I changed 2 lines of your code and it resolved the problem

local StartingScreen = script.Parent
local ParthiaButton = StartingScreen.MainFrame.Parthia
local player = game.Players.LocalPlayer
local TeamInform = StartingScreen.MainFrame.TeamInform
local RomeButton = StartingScreen.MainFrame.Rome
StartingScreen.Enabled = true

ParthiaButton.MouseButton1Click:Connect(function()
    print("Assigned team to Parthia")
    ParthiaButton.ImageTransparency = 0.6
    TeamInform:TweenPosition(UDim2.new(0.4, 0,0.6, 0),"Out","Bounce",3)
    TeamInform.Text = "Your team is the Parthian Empire!"
    if player.Team == game.Teams.Rome then
        RomeButton.ImageTransparency = 0
        end
        player.Team = game.Teams.Parthia
end)


RomeButton.MouseButton1Click:Connect(function()
    print("Assigned team to Rome")
    TeamInform:TweenPosition(UDim2.new(0.4, 0,0.6, 0),"Out","Bounce",3)
    TeamInform.Text = "Your team is the Rome Empire!"
    RomeButton.ImageTransparency = 0.6
    if player.Team == game.Teams.Parthia then
        ParthiaButton.ImageTransparency = 0
       end

player.Team = game.Teams.Rome end)

0
Thanks! This really helped. iiDevPanda 43 — 4y
Ad

Answer this question