Hello! im going into a state of mentality with this issue.
What im trying to achieve is to get a cursor to rotate when hovering over a clickable (literally a rip off from blackout revival)
i have tried to use tweens, but i get this issue
Players.QZJ0.PlayerGui.ScreenGui.ImageLabel.LocalScript:39: attempt to call missing method ‘Create’ of table
here is the script i tried using -
local ClickableTween = game:GetService("TweenService")
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local descendants = workspace:GetDescendants()
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Cursor = script.Parent
local Last = Vector2.new(0, 1)
local function UpdateCursor()
local Position = UserInputService:GetMouseLocation()
local Delta = Last - Position
Cursor.Position = UDim2.new(-0.0025, Position.X, -0.0525, Position.Y)
Last = Position
end
UserInputService.MouseIconEnabled = false
RunService.Heartbeat:Connect(UpdateCursor)
local descendants = game.StarterGui:GetDescendants()
local tweeninfo = TweenInfo.new(
0.2,
Enum.EasingStyle.Circular,
Enum.EasingDirection.In,
0,
false,
0
)
local hovertween = TweenInfo:Create(Cursor, TweenInfo, {Rotation = 45})
local hovertween2 = TweenInfo:Create(Cursor, TweenInfo, {Size = {0,13},{0,13}})
local unhovertween = TweenInfo:Create(Cursor, TweenInfo, {Rotation = 0})
local unhovertween2 = TweenInfo:Create(Cursor, TweenInfo, {Size = {0,11},{0,11}})
for i, descendant in pairs(descendants) do
if descendant:IsA("ImageButton") then
descendant.MouseEnter:Connect(function()
hovertween:Play()
hovertween2:Play()
end)
descendant.MouseLeave:Connect(function()
unhovertween:Play()
unhovertween2:Play()
end)
end
end
its not the most practical script, and im pretty new, so any help is APPRECIATEDDDD!!!
As tweeninfo information for the tweens you are using the library of functions Tweeninfo, the same one you created the tweeninfo variable. You should be using the “tweeninfo” variable.
for i, descendant in pairs(descendants) do
if descendant:IsA("ImageButton") then
descendant.MouseEnter:Connect(function()
hovertween:Play()
hovertween2:Play()
end)
descendant.MouseLeave:Connect(function()
unhovertween:Play()
unhovertween2:Play()
end)
end
end
local ClickableTween = game:GetService("TweenService")
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local descendants = workspace:GetDescendants()
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Cursor = script.Parent
local Last = Vector2.new(0, 1)
local function UpdateCursor()
local Position = UserInputService:GetMouseLocation()
local Delta = Last - Position
Cursor.Position = UDim2.new(-0.0025, Position.X, -0.0525, Position.Y)
Last = Position
end
UserInputService.MouseIconEnabled = false
RunService.Heartbeat:Connect(UpdateCursor)
local TweenService = game:GetService("TweenService")
local descendants = game.StarterGui:GetDescendants()
local tweeninfo = TweenInfo.new(
0.2,
Enum.EasingStyle.Circular,
Enum.EasingDirection.In,
0,
false,
0
)
local hovertween = TweenService:Create(Cursor, tweeninfo, {Rotation = 45})
local hovertween2 = TweenService:Create(Cursor, tweeninfo, {Size = UDim2.new(0, 13, 0, 13)})
local unhovertween = TweenService:Create(Cursor, tweeninfo, {Rotation = 0})
local unhovertween2 = TweenService:Create(Cursor, tweeninfo, {Size = UDim2.new(0, 13, 0, 13)})
for i, descendant in pairs(descendants) do
if descendant:IsA("ImageButton") then
descendant.MouseEnter:Connect(function()
hovertween:Play()
hovertween2:Play()
end)
descendant.MouseLeave:Connect(function()
unhovertween:Play()
unhovertween2:Play()
end)
end
end
Well, you could just add a
local debounce = false
And put an
if (not debounce) then
In the update cursor function, and put an
debounce = true
when you play the tweens.