Cant put varaible into tweenservice:create

im prob being dumb but idk why its erroring

local function TweenFunction(instance, attribute, attributeSetting, TimeToTween : number) : Tween
	return TweenService:Create(instance, TweenInfo.new(TimeToTween, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {attribute = attributeSetting})
end
TweenFunction(humanoid, humanoid.WalkSpeed, humanoid.WalkSpeed + runSpeed, .6):Play()
TweenService:Create no property named 'attribute' for object 'Humanoid'  -  Client - runScript:15

Instead of using Humanoid.Walkspeed as a second parameter try “WalkSpeed”

1 Like

Hi thanks for responding

TweenFunction(humanoid, "WalkSpeed", humanoid.WalkSpeed + runSpeed, .6):Play()
TweenService:Create no property named 'attribute' for object 'Humanoid'  -  Client - runScript:15

still same error idk why

Try this:

local function TweenFunction(instance, attribute, attributeSetting, TimeToTween : number) : Tween
	return TweenService:Create(instance, TweenInfo.new(TimeToTween, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {[attribute] = attributeSetting})
end

The issue is probably that it is trying to set the property “attribute” to variable attributeSetting

2 Likes

thanksthanksthanks :happy4: :happy4: :happy4: :happy4: :happy4: :happy4: :happy4: :happy4:

2 Likes