That’s not quite right. It’s a good start, but when you use :Connect()
you don’t need a extra parenthesis “)” after the function. Also everything is case sensitive, meaning that certain functions / keywords need to be capitalized a certain way. You did this on this line of code:
Your code:
humanoid.statechanged:Connect(function(newstate))
That should turn into this:
humanoid.StateChanged:Connect(function(newState)
end
See how I don’t have a extra parenthesis, and StateChanged
is capitalized a certain way.
Also you don’t need to make a willTween
variable. You can just do the following:
-- Your variable doesn't need to be called guiObject, it can be called anything you name it!
guiObject:TweenSize(
UDim2.new(10, 10, 10, 10),
Enum.EasingStyle.Out,
Enum.EasingStyle.Sine,
2
)
Finally all of that would turn into this:
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
main:TweenSize(
UDim2.new(10, 10, 10, 10),
Enum.EasingStyle.Out,
Enum.EasingStyle.Sine,
2
)
elseif newState == Enum.HumanoidStateType.Landed then
main:TweenSize(
UDim2.new(0, 0, 0, 0),
Enum.EasingStyle.Out,
Enum.EasingStyle.Sine,
2
)
end
end)