Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = playerGui
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 200, 0, 200)
- button.Position = UDim2.new(0.5, -100, 0.5, -25)
- button.Text = "Hover Me"
- button.Parent = screenGui
- local gradient = Instance.new("UIGradient")
- gradient.Color = ColorSequence.new{
- ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
- ColorSequenceKeypoint.new(0.4, Color3.fromRGB(255, 0, 0)),
- ColorSequenceKeypoint.new(0.6, Color3.fromRGB(0, 0, 255)),
- ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 255))
- }
- gradient.Parent = button
- local TweenService = game:GetService("TweenService")
- local function createTween(object, properties, duration)
- local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
- local tween = TweenService:Create(object, tweenInfo, properties)
- return tween
- end
- local isHovering = false
- button.MouseEnter:Connect(function()
- isHovering = true
- local tween = createTween(gradient, {Rotation = 180}, 1)
- tween:Play()
- end)
- button.MouseLeave:Connect(function()
- isHovering = false
- local tween = createTween(gradient, {Rotation = 0}, 1)
- tween:Play()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement