- What do you want to achieve? Keep it simple and clear!
Scale the player down without the glitch showed in the video happening.
-
What is the issue? Include screenshots / videos if possible!
https://streamable.com/i40tej -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
instead of scaling the player down I tried to respawn the player in the same spot, but that reset the cooldown UI.
local Width = 4
local Height = 4
local Depth = 4
local Head = nil
local UIS=game:GetService("UserInputService")
local Vector = Vector3.new(Width, Height, Depth)
local VectorShrink = Vector3.new(0.25,0.25,0.25)
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StompEvent = ReplicatedStorage.StompEvent
local KeyCode = Enum.KeyCode.F
local tweenService = game:GetService("TweenService")
function scaleup(plr)
local Humanoid = plr.Character.Humanoid
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Motors = {}
table.insert(Motors, plr.Character.HumanoidRootPart.RootJoint)
for i,Motor in pairs(plr.Character.Torso:GetChildren()) do
if Motor:IsA("Motor6D") == false then continue end
table.insert(Motors, Motor)
end
for i,v in pairs(Motors) do
v.C0 = CFrame.new((v.C0.Position * Vector)) * (v.C0 - v.C0.Position)
v.C1 = CFrame.new((v.C1.Position * Vector)) * (v.C1 - v.C1.Position)
end
for i,Part in pairs(plr.Character:GetChildren()) do
if Part:IsA("BasePart") == false then continue end
Part.Size *= Vector
end
if plr.Character.Head.Mesh.MeshId ~= "" then
plr.Character.Head.Mesh.Scale *= Vector
end
for i,Accessory in pairs(plr.Character:GetChildren()) do
if Accessory:IsA("Accessory") == false then continue end
Accessory.Handle.AccessoryWeld.C0 = CFrame.new((Accessory.Handle.AccessoryWeld.C0.Position * Vector)) * (Accessory.Handle.AccessoryWeld.C0 - Accessory.Handle.AccessoryWeld.C0.Position)
Accessory.Handle.AccessoryWeld.C1 = CFrame.new((Accessory.Handle.AccessoryWeld.C1.Position * Vector)) * (Accessory.Handle.AccessoryWeld.C1 - Accessory.Handle.AccessoryWeld.C1.Position)
Accessory.Handle:FindFirstChildOfClass("SpecialMesh").Scale *= Vector
end
end
end
function scaledown(plr)
local Humanoid = plr.Character.Humanoid
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Motors = {}
table.insert(Motors, plr.Character.HumanoidRootPart.RootJoint)
for i,Motor in pairs(plr.Character.Torso:GetChildren()) do
if Motor:IsA("Motor6D") == false then continue end
table.insert(Motors, Motor)
end
for i,v in pairs(Motors) do
v.C0 = CFrame.new((v.C0.Position * VectorShrink)) * (v.C0 - v.C0.Position)
v.C1 = CFrame.new((v.C1.Position * VectorShrink)) * (v.C1 - v.C1.Position)
end
for i,Part in pairs(plr.Character:GetChildren()) do
if Part:IsA("BasePart") == false then continue end
Part.Size *= VectorShrink
end
if plr.Character.Head.Mesh.MeshId ~= "" then
plr.Character.Head.Mesh.Scale *= VectorShrink
end
for i,Accessory in pairs(plr.Character:GetChildren()) do
if Accessory:IsA("Accessory") == false then continue end
Accessory.Handle.AccessoryWeld.C0 = CFrame.new((Accessory.Handle.AccessoryWeld.C0.Position * VectorShrink)) * (Accessory.Handle.AccessoryWeld.C0 - Accessory.Handle.AccessoryWeld.C0.Position)
Accessory.Handle.AccessoryWeld.C1 = CFrame.new((Accessory.Handle.AccessoryWeld.C1.Position * VectorShrink)) * (Accessory.Handle.AccessoryWeld.C1 - Accessory.Handle.AccessoryWeld.C1.Position)
Accessory.Handle:FindFirstChildOfClass("SpecialMesh").Scale *= VectorShrink
end
end
end
StompEvent.OnServerEvent:Connect(function(plr)
if plr == nil then return end
if plr.Character:GetAttribute("Scaled") == true then return end
plr.Character:SetAttribute("Scaled", true)
local Humanoid = plr.Character.Humanoid
scaleup(plr)
local animator = Humanoid:WaitForChild("Animator")
local StompAnimation = animator:LoadAnimation(script.UpAnimation)
local HoldAnimation = animator:LoadAnimation(script.HoldAnimation)
local DownAnimation = animator:LoadAnimation(script.DownAnimation)
local movePos = plr.Character.HumanoidRootPart.Position
plr.Character.HumanoidRootPart.Position += Vector3.new(0,50,0)
plr.Character.HumanoidRootPart.Anchored = true
StompAnimation:Play()
HoldAnimation:Play()
wait(2)
plr.Character.HumanoidRootPart.Anchored = false
plr.Character:MoveTo(movePos)
HoldAnimation:Stop()
local Cracks = ReplicatedStorage.Cracks:Clone()
Cracks.Parent = game.Workspace
Cracks.Position = plr.Character.HumanoidRootPart.Position
Cracks.Position -= Vector3.new(0,4,0)
local Shockwave = ReplicatedStorage.Shockwave:Clone()
Shockwave.Parent = game.Workspace
Shockwave.Position = plr.Character.HumanoidRootPart.Position
Shockwave.Position -= Vector3.new(0,2,0)
local tweenInfo = TweenInfo.new(3,Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 1, false, 0)
local goal = {Size = Vector3.new(4008.415, 3.599, 4009.599)}
local tween = tweenService:Create(Shockwave, tweenInfo, goal)
tween:Play()
for i = 1,50 do
Shockwave.Transparency+= 0.02
Cracks.Transparency += 0.01
wait()
end
scaledown(plr)
Shockwave:Destroy()
for i = 1,50 do
Cracks.Transparency += 0.01
wait()
end
end)