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

Help with Syntax and events?

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?

3 comments

0

has player been defined?

0

yes but i loop through every player running that code with a server script so player changes each time does that affect anything ?

0

No.

2 answers

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

1 comment

0

there i added a definition does that change anything tho?

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.

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