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

Help with Syntax and events?

Asked by 9 years ago

Alright so im making a game where i write out a few textlabels in code and i need to give them events right now im just giving it an event striaght up but its not working

heres what i have

for i, player in pairs(game.Players:GetPlayers()) do
    local newLabel = Instance.new("TextLabel")
    newLabel.Parent = player.PlayerGui.ScreenGui

    newLabel.MouseEnter:connect(function()
        --code

    end) 
end

is this right?

0
has player been defined? TheDeadlyPanther 2460 — 9y
0
yes but i loop through every player running that code with a server script so player changes each time does that affect anything ? ProfessorSev 220 — 9y
0
No. TheDeadlyPanther 2460 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

I think assigning a value to player would help a bit. Other than that its fine

0
there i added a definition does that change anything tho? ProfessorSev 220 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Mouse functions are not included in Text Label objects. I learnt that a while ago.

For your event to work, simply change the Text Label into a Text Button. Mouse functions work for Text Buttons.

Your welcome.

Answer this question