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

Stupidly simple size-tweening hover script, how come I can't get this working?

The button should enlarge as your cursor hovers over it, but since I'm new to scripting, I don't know how to make this work.

function onButtonHover()
	script.Parent:TweenSize(UDim2.new(0,275,0,50))
end
script.Parent.MouseEnter:connect(onButtonHover)

function onButtonHover2()
	script.Parent:TweenSize(UDim2.new(0,250,0,50))
end
script.Parent.MouseLeave:connect(onButtonHover2)

1 comment

0

http://hastebin.com/igoqivizif.lua I've explained this to you in the chat, so I won't bother adding an answer, I'll just post the solution.

1 answer

Your problem lies here, it is supposed to be a local script in the TextButton, not a regular script. Reason being is normal scripts do things on the server like example:

game.Workspace.Part.BrickColor = BrickColor.Green()

That is something you would use a local script for. But anything in GUI's you have to use local scripts because it run's on the ROBLOX Client. A.K.A your computer. So when you use your script for a GUI it is trying to run on the ROBLOX Server but can't. So it gives no errors or runs at all.

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