Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I use TweenService to rotate this part?

Asked by 5 years ago

The Client Script

--//Variables 
local Cooldown = false
local CDTIME = 26
local Player = game.Players.LocalPlayer
local Tool = script.Parent


Tool.Equipped:Connect(function()
    Tool.RemoteEvent:FireServer()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0 
    local Animation = Tool.Animation
    local animationTrack = Player.Character.Humanoid:LoadAnimation(Animation)
    animationTrack.Priority = Enum.AnimationPriority.Action
    animationTrack:Play()
    Tool.Sound:Play()
    wait(2.5)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30


Tool.Unequipped:Connect(function()
    Tool.Sound:Stop()
    animationTrack:Stop()
    end)
end)

The Server Script

--//Variables 
local Tool = script.Parent
local Cooldown = false
local CDTIME = 0

Tool.RemoteEvent.OnServerEvent:Connect(function(Player)
    --//Cooldown
    if Cooldown then return end 
    Cooldown = true 

    spawn(function()
        wait(CDTIME)
        Cooldown = false 
    end)

Tool.Unequipped:Connect(function()
    Tool.Handle.Attachment.ParticleEmitter.Transparency = NumberSequence.new(1)
    Tool.Handle.ParticleEmitter1.Transparency = NumberSequence.new(1)
    Tool.Handle.ParticleEmitter1.Size = NumberSequence.new(.5)
    Tool.Handle.Attachment.ParticleEmitter.Size = NumberSequence.new(.5)

end)


--//Grow    
wait(1.5)
Tool.Handle.Attachment.ParticleEmitter.Transparency = NumberSequence.new(0)
Tool.Handle.ParticleEmitter1.Transparency = NumberSequence.new(0)
wait(.15)
Tool.Handle.Attachment.ParticleEmitter.Size = NumberSequence.new(0.6)
Tool.Handle.ParticleEmitter1.Size = NumberSequence.new(0.6)
wait(.15)
Tool.Handle.Attachment.ParticleEmitter.Size = NumberSequence.new(0.7)
Tool.Handle.ParticleEmitter1.Size = NumberSequence.new(0.7)
wait(.15)   
Tool.Handle.Attachment.ParticleEmitter.Size = NumberSequence.new(0.8)
Tool.Handle.ParticleEmitter1.Size = NumberSequence.new(0.8)
wait(.15)
Tool.Handle.Attachment.ParticleEmitter.Size = NumberSequence.new(0.9)
Tool.Handle.ParticleEmitter1.Size = NumberSequence.new(0.9) 
wait(.15)
Tool.Handle.Attachment.ParticleEmitter.Size = NumberSequence.new(1)
Tool.Handle.ParticleEmitter1.Size = NumberSequence.new(1)

--//Explosion & Damage & Knockback
Tool.Handle.Touched:Connect(function(hit)
    if hit and hit.Parent:FindFirstChild("Humanoid") then 
    local EnemyHumanoid = hit.Parent:FindFirstChild("Humanoid")
    local EnemyChar = EnemyHumanoid.Parent
    if hit.Parent == Player.Character then return end
    EnemyHumanoid:TakeDamage(5)
    local TweenService = game:GetService("TweenService")
    local Part = Instance.new("Part",workspace)
    Part.Anchored = true 
    Part.CFrame = hit.Parent.HumanoidRootPart.CFrame 
    Part.CanCollide = false 
    Part.Size = Vector3.new(20,20,20)
    Part.Shape = Enum.PartType.Ball
    Part.BrickColor = BrickColor.new("Toothpaste")
    Part.Material = Enum.Material.Neon
    local info = TweenInfo.new(
        2,
        Enum.EasingStyle.Quad,
        Enum.EasingDirection.In,
        2,
        false,
        0
    )

    local goal = {
    CFrame = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(280),0)
    }

    local Tween = TweenService:Create(Part,info,goal)
    Tween:Play()

    hit.Parent.HumanoidRootPart.Velocity = Vector3.new(0,50,100)
    wait(.3)
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, -34)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, -68)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, -102)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, -136)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, -170)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, 156)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, 122)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, 88)
    wait()
    hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 0, 40)
    wait()



        end
    end)    
end)


Here is a gif of what is happening: https://gyazo.com/8e0e4a60f555e1b5d3ac3670c107cc55

How do I make it so the part rotates buts stays still right now it does not work at all. I want the blue neon part to rotate and stay in a ball formation but it asks me for all the easing style and other stuff so it messes it up? Kinda like simulating an explosion?

0
tween it to 180 degrees User#23365 30 — 5y

Answer this question