I have a script that will make a shock wave when a player hits the ground with a sword. And it uses tween service to get bigger, though every time It plays the shock wave gets bigger and bigger. I tried to set the tween service to reverse = true but it didn’t work, plus re define the size at the end of the script. Not sure what the issue is…
(Not really relevant but this is the largest script I have written by myself!!! :D)
local wind = Instance.new("Part", game.Workspace)
wind.Shape = "Cylinder"
wind.Size = Vector3.new(0.7,30.1,74.3)
wind.BrickColor = BrickColor.new("Ghost grey")
wind.Anchored = true
wind.CanCollide = false
wind.Transparency = 1
wind.Material = "SmoothPlastic"
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(
5,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Goals =
{
Size = Vector3.new(1,100,100) ;
}
local flash = TweenService:Create(wind,Info,Goals)
local Players = game:GetService("Players")
local player = Players:FindFirstChild("trueblockhead101")
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local hi = character:WaitForChild("HumanoidRootPart")
local tool = script.Parent
function swing()
local swing = Instance.new("Animation")
swing.AnimationId = "rbxassetid://7193950823"
local wham = humanoid:LoadAnimation(swing)
wham:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, math.rad(0), math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
flash:Play()
wind.Transparency = .8
wait(.2)
wind.Transparency = .6
wait(.2)
wind.Transparency = .3
wait(.2)
wind.Transparency = 1
wind.Size = Vector3.new(0.7,30.1,74.3)
end
tool.Activated:Connect(swing)
Really? Could you provide a video on how it happens? That’s really unexpected behavior, the Size would Tween the same which is odd
robloxapp-20210803-1327314.wmv (552.2 KB)
Click open with tv to view the video
Any ideas on what is wrong?
Weird, could you maybe try this perhaps?
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(
5,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Goals =
{
Size = Vector3.new(1,100,100) ;
}
local flash = TweenService:Create(wind,Info,Goals)
local Players = game:GetService("Players")
local player = Players:FindFirstChild("trueblockhead101")
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local hi = character:WaitForChild("HumanoidRootPart")
local tool = script.Parent
function swing()
local wind = Instance.new("Part", game.Workspace)
wind.Shape = "Cylinder"
wind.Size = Vector3.new(0.7,30.1,74.3)
wind.BrickColor = BrickColor.new("Ghost grey")
wind.Anchored = true
wind.CanCollide = false
wind.Transparency = 1
wind.Material = "SmoothPlastic"
local swing = Instance.new("Animation")
swing.AnimationId = "rbxassetid://7193950823"
local wham = humanoid:LoadAnimation(swing)
wham:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, math.rad(0), math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
flash:Play()
flash.Completed:Connect(function()
wind:Destroy()
end)
wind.Transparency = .8
wait(.2)
wind.Transparency = .6
wait(.2)
wind.Transparency = .3
wait(.2)
wind.Transparency = 1
wind.Size = Vector3.new(0.7,30.1,74.3)
end
tool.Activated:Connect(swing)
It should work the same, the only thing I could think of the reason being is that you’re increasing the size somewhere within that script? I’m unsure
No doesn’t work. Its doing the same thing but now after I swing the sword 3 times the “wind” doesn’t show!