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

I don't understand what I'm doing wrong..?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So..I have 2 scripts that I'm working on. The first one is for making my gui button function...here's what I have, which doesn't seem to work:

player = game.Players.PlayerAdded
button = script.Parent
function click()
    if click then
        game.StarterGui.FNMain.Frame.Play.Transparency = 1
        wait(.2)
        game.StarterGui.FNMain.Frame.Play.Transparency = 0
    end
end
button.MouseButton1Click:connect(click)


and then theres my 2nd script which I have been working very hard to get to work and it isn't...so I have a Gui Image that I want to go from 1 transparency to 0 transparency decreasing by .5. I have 3 scripts I attempted which won't work. Here are both:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:wait()
local x=game.StarterGui.FNMain.Frame.ImageLabel
for i=1,10 do
wait(0.5)
x.ImageTransparency = x.ImageTransparency-0.1
end 
end)

Here's the 2nd script:

--[[x=game.StarterGui.FNMain.Frame.ImageLabel
for i=1,10 do
wait(0.5)
x.ImageTransparency = x.ImageTransparency-0.1
end]]

Here's the 3rd script:

local a = game.StarterGui.FNMain.Frame.ImageLabel 

for _ = 0, 1, .1 do
a.ImageTransparency = _
end

SORRY THAT THIS IS SO BIG..!

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

All 3 ways would've worked if you properly defined your paths. This applies to every script that you've posted. If you just use game.StarterGui, that would change the GUI in StarterGui, NOT the Player's GUI. I would make all of the scripts local, and instead of game.StarterGui, put game.Players.LocalPlayer.PlayerGui. For the very first script, you didn't need to use the PlayerAdded event (Even though you didn't use it correctly).

Ad

Answer this question