hi, I’ve encountered a problem that somehow doesn’t make sense
although it errors, it still tweens the meshpart and turn it 90 radians
I don’t know where the error is, or what line is causing the erroring, but I am so fed up with this, lol
My modulescript source code
local TweenService = game:GetService("TweenService")
local module = {}
function module:CreateTween(
instance: Instance,
tweenTime: number,
easingStyle: string|Enum.EasingStyle,
easingDirection: string|Enum.EasingDirection,
repeatCount: number,
reverses: boolean,
delayTime: number,
propertyGoal,
yield: boolean
)
--// EasingStyle
if typeof(easingStyle) == "string" then
--local a = string.upper(easingStyle:sub(1, 1))..string.lower(easingStyle:sub(2, #easingStyle))
local status, data = pcall(function()
return Enum.EasingStyle[easingStyle]
end)
if not status then warn("That EasingStyle doesn't exist, try again!") end
easingStyle = data
elseif typeof(easingStyle) ~= "EnumItem" and typeof(easingStyle) ~= "string" then
warn("EasingStyle should be an Enum or string, try again!")
end
--// EasingDirection
if typeof(easingDirection) == "string" then
--local a = string.upper(easingDirection:sub(1, 1))..string.lower(easingDirection:sub(2, #easingDirection))
local status, data = pcall(function()
return Enum.EasingDirection[easingDirection]
end)
if not status then warn("That EasingDirection doesn't exist, try again!") end
easingDirection = data
elseif typeof(easingDirection) ~= "EnumItem" and typeof(easingDirection) ~= "string" then
warn("EasingDirection should be an Enum or string, try again!")
end
--// Checks if "propertyGoal" is a table
if typeof(propertyGoal) == "table" then
--print("passed propertyGoal")
elseif typeof(propertyGoal) ~= "table" then
warn("propertyGoal must be a table!")
end
--// Making the tween
local tweenInfo = TweenInfo.new(tweenTime, easingStyle, easingDirection, repeatCount, reverses, delayTime)
local tween = TweenService:Create(instance, tweenInfo, propertyGoal)
--print(tweenTime)
--print(instance.Name)
--// If the code will yield/wait for the event to complete
if yield then
tween:Play()
tween.Completed:Wait()
elseif not yield then
tween:Play()
elseif yield == nil then
tween:Play()
end
end
return module
My code that uses the modulescript
local runService = game:GetService("RunService")
local contextActionService = game:GetService("ContextActionService")
local repStorage = game:GetService("ReplicatedStorage")
local soundService = game:GetService("SoundService")
local swiftTween = require(repStorage:WaitForChild("SwiftTween"))
local tool = script.Parent
local hand = tool:WaitForChild("Hand")
local hitAnim = tool:WaitForChild("HitAnimation")
local stanceAnim = tool:WaitForChild("StanceAnimation")
local event = tool:WaitForChild("RemoteEvent")
local hitboxEnabled = false
local db = true
local bloom = game:GetService("Lighting"):WaitForChild("Bloom")
local colorC = game:GetService("Lighting"):WaitForChild("ColorCorrection")
local colors = {
Color3.new(1, 0.262745, 0.235294),
Color3.new(0.921569, 0.329412, 1),
Color3.new(0.917647, 1, 0.0196078)
}
local function awaitState(humanoid:Humanoid, humanoidState)
local disconnectFunction = false
local connection = humanoid.StateChanged:Connect(function(oldState, newState)
if oldState == Enum.HumanoidStateType.Jumping and newState == Enum.HumanoidStateType.Freefall then
return true
end
end)
end
local function activatedEvent()
local character = tool.Parent
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
if not (character and humanoid and animator) then return end
local animationTrack = animator:LoadAnimation(hitAnim)
animationTrack:Play()
hitboxEnabled = true
animationTrack.Ended:Connect(function()
hitboxEnabled = false
end)
end
local function timestopEvent(player)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
if not (character and humanoid and animator) then return end
humanoid.RootPart.Anchored = true
local animationTrack = animator:LoadAnimation(stanceAnim)
animationTrack:Play(0.2)
local quarterInterval = (soundService.timestop.TimeLength / 4)
local halfInterval = quarterInterval * 2
soundService.choir:Play()
soundService.choir.Ended:Wait(0.1)
soundService.timestop:Play()
task.spawn(function()
bloom.Threshold = 0.2
swiftTween:CreateTween(colorC, 1, "Linear", "Out", 0, false, 1, {Saturation = -1}, false)
swiftTween:CreateTween(colorC, 1, "Linear", "Out", 0, false, 1, {TintColor = Color3.fromHex("#999999")}, false)
task.wait(1.5)
bloom.Threshold = 2
task.wait(0.1)
bloom.Threshold = 0.2
task.wait(0.1)
bloom.Threshold = 2
task.wait(0.1)
bloom.Threshold = 0.2
task.wait(0.1)
bloom.Threshold = 2
end)
--bloom.Threshold = 0.4
--for i = 0, 5, 1 do
local interval = quarterInterval / 15
--print(interval)
task.spawn(function()
local tsWave = repStorage:WaitForChild("TimestopWave"):Clone()
tsWave.Parent = workspace
tsWave.CFrame = hand.CFrame
tsWave.Position = hand.Position
tsWave.Color = colors[math.random(1, #colors)]
swiftTween:CreateTween(tsWave, quarterInterval, "Exponential", "Out", 0, false, 0, {Size = Vector3.new(2048, 2048, 2048)}, false)
swiftTween:CreateTween(tsWave, halfInterval, "Quad", "Out", 0, false, 0, {CFrame = tsWave.CFrame * CFrame.Angles(0, math.rad(90), 0)}, false)
task.wait(halfInterval)
swiftTween:CreateTween(tsWave, quarterInterval, "Exponential", "Out", 0, false, 0, {Size = Vector3.new(.1, .1, .1)}, true)
tsWave:Destroy()
end)
task.wait(interval)
--end
soundService.timestop.Ended:Wait()
animationTrack:Stop()
humanoid.RootPart.Anchored = false
soundService.clock:Play()
soundService.clock.Ended:Wait()
swiftTween:CreateTween(colorC, 1, "Linear", "Out", 0, false, 0, {Saturation = 0}, false)
swiftTween:CreateTween(colorC, 1, "Linear", "Out", 0, false, 0, {TintColor = Color3.fromHex("#ffffff")}, false)
soundService.timeresume:Play()
soundService.timeresume.Ended:Wait()
--bloom.Threshold = 2
end
local function timestopEvent1(player)
print("trolololol")
end
tool.Activated:Connect(activatedEvent)
event.OnServerEvent:Connect(timestopEvent)
If you have any solutions, please share! Thanks in advance =)