Tween not working

  1. What do you want to achieve? Keep it simple and clear!
    When the “artevent” is triggered, the “Shock” mesh will rotate.
  2. What is the issue? Include screenshots / videos if possible!
    It does not rotate (VIDEO AND SCREENSHOT BELOW THE SCRIPT)
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried using a motor6D. I originally tried to use an animation, but moon animator does not allow you to export an animation without a rig.

My SERVERsword script

local Tool = script.Parent
local Handle = Tool.Handle
local Anims = Tool.Anims
local plrowner = script:FindFirstAncestorWhichIsA("Player") --player holding the part
local RaycastHitbox = require(game.ServerScriptService.RaycastHitboxV4)
local Hitbox = RaycastHitbox.new(Tool.Hitbox)
local HitboxWP = RaycastHitbox.new(Tool.Hitbox2)
local TweenService = game:GetService("TweenService")


local de = false
local de2 = false
local canHit = false
local canHitWP = false
local combo = 1


config = {
	Damage = 10,
	AttackTime = 0.16,
	Cooldown = .4
}

Hitbox.OnHit:Connect(function(hit, humanoid, raycastResult)
	if canHit == false then return end
	canHit = false
	if humanoid.Parent ~= script.Parent.Parent and humanoid.Parent.Parrying.Value == false then
		local hitPosition = raycastResult.Position
		local partthing = game.ReplicatedStorage.thepart:Clone()
		partthing.Parent = workspace
		partthing.CFrame = CFrame.new(hitPosition)
		humanoid:TakeDamage(config.Damage)
		task.wait(.35)
	elseif humanoid.Parent.Parrying.Value == true then
		print("ouchies")
		task.wait(.35)
	end
	canHit = true
end)



HitboxWP.OnHit:Connect(function(hit, humanoid, raycastResult)
	if canHitWP == false then return end
	canHitWP = false
	if humanoid.Parent ~= script.Parent.Parent and humanoid.Parent.Parrying.Value == false then
		humanoid:TakeDamage(15)
	elseif humanoid.Parent.Parrying.Value == true then
		humanoid:TakeDamage(20)
    end
	canHitWP = true
end)



script.Parent.Hit1.OnServerEvent:Connect(function(Player)
		if de == false then
			de = true
			local Humanoid = Player.Character.Humanoid
			local AnimationsList = Anims:GetChildren()
			local load = Humanoid:LoadAnimation(Anims.Slice1)
			local load2 = Humanoid:LoadAnimation(Anims.Slice2)
			if combo == 1 then
				load.Priority = Enum.AnimationPriority.Action4
				load2:Stop()
				load:Play()
				combo += 1
				Tool.Handle.SwordSlash:Play()
			elseif combo == 2 then
				load2.Priority = Enum.AnimationPriority.Action4
				load:Stop()
				load2:Play()
				combo -= 1
				Tool.Handle.SwordSlash2:Play()
			end
			task.wait(config.AttackTime)

			Tool.Trail.Enabled = true
			Player.Character.Attacking.Value = true
			Hitbox:HitStart()
			canHit = true
			Humanoid.WalkSpeed = 10

			task.wait(config.Cooldown)

			Player.Character.Attacking.Value = false
			Tool.Trail.Enabled = false
			Humanoid.WalkSpeed = 16
			Hitbox:HitStop()
			canHit = false
			de = false
		end
end)



local tweenInfo = TweenInfo.new(
	2.5, -- Time
	Enum.EasingStyle.Exponential, -- EasingStyle
	Enum.EasingDirection.InOut, -- EasingDirection
	0, -- RepeatCount 
	true, -- Reverses 
	0 -- DelayTime
)
local shocktween = TweenService:Create(Tool.Shock, tweenInfo, {CFrame = Tool.ShockTween.CFrame})

script.Parent.artevent.OnServerEvent:Connect(function(Player)
	if de2 == false then
		de2 = true
		local Humanoid = Player.Character.Humanoid
		local AnimationsList = Anims:GetChildren()
		local load = Humanoid:LoadAnimation(Anims.WEAPONARTthrust)
		load.Priority = Enum.AnimationPriority.Action4
		load:Play()
		Tool.Handle.SwordSlash:Play()
		
		task.wait(0.1)
		Tool.Shock.Transparency = 0
		shocktween:Play() -- play the tween
		HitboxWP:HitStart()
		Player.Character.Attacking.Value = true
		canHitWP = true
		game.ReplicatedStorage.weaponarttimer:FireClient(Player)
		
		task.wait(1)
		Tool.Shock.Transparency = 1
		HitboxWP:HitStop()
		Tool.Trail.Enabled = false
		Player.Character.Attacking.Value = false
		
		task.wait(4)
		
		Humanoid.WalkSpeed = 16
		canHitWP = false
		de2 = false
	end
end)

The explorer tab:

A video of it not working:
robloxapp-20240109-2326186.wmv (2.0 MB)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You’re having trouble with the “Shock” mesh rotation when triggering the “artevent.” It looks like you’re using a TweenService for rotation, but a few adjustments might help:

  1. Check Initial Rotation:
  • Make sure the “Shock” mesh starts with the right rotation. If it already has a rotation that conflicts with the tween, it might not work well.
  1. Adjust Tween Settings:
  • Play around with the numbers in TweenInfo.new. Try different values for time, easing style, and other settings to get the rotation effect you want.

Here’s a simpler example:

local tweenInfo = TweenInfo.new(
    2.5, -- Time
    Enum.EasingStyle.Linear, -- EasingStyle (try different styles)
    Enum.EasingDirection.InOut, -- EasingDirection
    0, -- RepeatCount 
    false, -- Reverses 
    0 -- DelayTime
)

local rotationGoal = CFrame.Angles(math.rad(360), 0, 0) -- Rotate 360 degrees around X-axis

local shocktween = TweenService:Create(Tool.Shock, tweenInfo, {CFrame = rotationGoal})

script.Parent.artevent.OnServerEvent:Connect(function(Player)
    -- Your existing code...

    Tool.Shock.Transparency = 0
    Tool.Shock.CFrame = Tool.ShockTween.CFrame -- Set the initial position if needed

    shocktween:Play()

    -- Your existing code...
end)

In this example, I’ve adjusted the TweenInfo and added a rotationGoal that represents a 360-degree rotation around the X-axis. Make sure to adjust the values based on your requirements.

Also, check for any errors in the output or console for more clues about what’s going wrong.

Oh yeah, i forgot the change the title from CFrame to Tween whoops. The Tool.Shock.CFrame = Tool.ShockTween.CFrame line just made my character unstable and flying around. Does a weld interfere with a tween? because i have welded the Shock mesh to the handle of the tool.