QUESTION: So, I was making a SSJ Transformation from the Anime Dragon Ball Z. I have found some errors while scripting this.
ERRORS: So It appears the transformation is spamable and when 2 players are in the server, The Aura parts seems to get confused and gets removed and re added many times from who ever. Can I get a hand on this?
LOCAL SCRIPT:
local Player = game.Players.LocalPlayer
local Character = Player.Character
repeat wait() until Player or Character ~= nil
-- input values
local UIS = game:GetService("UserInputService")
-- call folders
local Animations = script.Animations
local Values = script.Values
local Particles = script.Particles
-- local script variables
local CanTransform = true
local InSSJ = false
local DebounceWait = 5
--{{ transformation local script }}--
UIS.InputBegan:Connect(function(input, gpe)
if input.KeyCode ~= Enum.KeyCode.Z then return end;
if gpe then return end;
if CanTransform == true then else return end;
CanTransform = false
InSSJ = true
print("SSJ")
-- remoteEvent
game.ReplicatedStorage.RemoteEvents.Transformations.TransformSSJEvent:FireServer()
wait(DebounceWait)
end)
-- {{ deform local script }}--
UIS.InputBegan:Connect(function(input, gpe)
if input.KeyCode ~= Enum.KeyCode.X then return end;
if gpe then return end;
if CanTransform == false then else return end;
InSSJ = false
print("Base")
-- remotevent
game.ReplicatedStorage.RemoteEvents.Transformations.TransformSSJEvent:FireServer()
wait(DebounceWait)
CanTransform = true
end)
SCRIPT:
-- call whats needed
local ReplicatedStorage = game.ReplicatedStorage
local Effects = ReplicatedStorage.Effects
local Values = script.Parent.Values
local InSSJValue = Values.InSSJValue.Value
local Particles = script.Parent.Particles
--{{ transformation server script }}--
ReplicatedStorage.RemoteEvents.Transformations.TransformSSJEvent.OnServerEvent:Connect(function(Player)
if InSSJValue == false then
InSSJValue = true
-- animation n junk
-- inhale Power Effect
local UnderDustRing = game.ReplicatedStorage.Effects.DustRingIn:Clone()
UnderDustRing.Parent = Player.Character
UnderDustRing.CFrame = Player.Character["HumanoidRootPart"].CFrame * CFrame.new(0, -1.5, 0) * CFrame.Angles(0, math.random(-90, 90), 0)
-- color tween
local TweenService = game:GetService("TweenService")
local Hair = Player.Character.BaseHair
local Info = TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 0, false, 0)
local Goals = {Color = Color3.new(1, 1, 1)}
local FadeInHair = TweenService:Create(Hair, Info, Goals)
FadeInHair:Play()
wait(2)
-- ki explosion + power release
for i = 1, 5 do
local Ki = game.ReplicatedStorage.Effects.KiExplosionPart:Clone()
Ki.Parent = Player.Character
Ki.Size = Vector3.new(1, 1.525, 1)
Ki.CFrame = Player.Character["HumanoidRootPart"].CFrame * CFrame.Angles(math.random(-90, 90), math.random(-90, 90), math.random(-90, 90))
end
-- change hair transparency + aura
Player.Character.BaseHair.Transparency = 1
Player.Character.SSJHair.Transparency = 0
Aura = Particles.SSJAura:Clone()
Aura.Parent = Player.Character["UpperTorso"]
Aura.Enabled = true
for i = 1, 15 do
local UnderRustRingOut = game.ReplicatedStorage.Effects.DustRingOut:Clone()
UnderRustRingOut.Parent = Player.Character
UnderRustRingOut.CFrame = Player.Character["HumanoidRootPart"].CFrame * CFrame.new(0, -1.5, 0) * CFrame.Angles(0, math.random(-90, 90), 0)
wait(0.01)
end
-- power boosts
print("SSJ is True")
else
if InSSJValue == true then
InSSJValue = false
-- animation n junk
-- change hair transparency
Player.Character.BaseHair.Transparency = 0
Player.Character.SSJHair.Transparency = 1
Aura.Enabled = false
-- color tween
local TweenService = game:GetService("TweenService")
local Hair = Player.Character.BaseHair
local Info = TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 0, false, 0)
local Goals = {Color = Color3.new(0, 0, 0)}
local FadeOutHair = TweenService:Create(Hair, Info, Goals)
FadeOutHair:Play()
-- remove power boosts
print("SSJ is False")
wait(1)
Aura:Remove()
wait(5)
end
end
end)
