Recently, I've been taking slow steps to code a player "God" script. However, after I figure out a problem, another problem mounts on. This time, local sound on line 76 keeps looping without end and I cant seem to break the function. No matter what I do, the problem gets worse. Any way to break the function permanently?
Here's the code: (Code starts after `)
`` local UIS = game:GetService('UserInputService') local plr = game.Players.LocalPlayer local Char = plr.Character or plr.CharacterAdded:Wait()
local key = 'L'
local Anim = Instance.new("Animation") Anim.AnimationId = 'rbxassetid://4906894017'
local Debounce = true
UIS.InputBegan:Connect (function(Input, IsTyping) if IsTyping then return
end
local KeyPressed = Input.KeyCode
if KeyPressed == Enum.KeyCode.L and Debounce then
Debounce = false
local LoadAnimation = Char.Humanoid:LoadAnimation(Anim)
LoadAnimation:play()
print("The Crimson God Has Been Summoned; Run...")
local CrimGod = true
-- KONO DIO DA
if CrimGod == true then
local sound1 = game.Workspace.ChargeUp
wait(2)
sound1:Play()
local orb = game.Workspace.Part
if orb then
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
orb.Shape = "Cylinder"
orb.Material = "Neon"
local weld = Instance.new("WeldConstraint")
weld.Parent = workspace
weld.Part0 = orb
weld.Part1 = character.HumanoidRootPart
if player.Character:FindFirstChild("Torso") == nil then --checks to see if player is r15
orb.Position = Vector3.new (player.Character.LowerTorso.Position.X,player.Character.LowerTorso.Position.Y,player.Character.LowerTorso.Position.Z)
else --this is what happens if r6
orb.Position = Vector3.new (player.Character.Torso.Position.X,player.Character.Torso.Position.Y,player.Character.Torso.Position.Z)
end
end end
local tweenService = game:GetService("TweenService")
local part = game.Workspace.Part
local tweeningInformation = TweenInfo.new(
0.5, --length
Enum.EasingStyle.Cubic, --Easing Style
Enum.EasingDirection.InOut,
0, --Times repeated
false, --Reverse or no?
0 -- delay for tween
)
local partProperties = {
Size = Vector3.new(877.04,149.27,80.24);
Transparency = 1;
CanCollide = false
}
local tween = tweenService:Create(part,tweeningInformation,partProperties)
tween:Play()
end
wait(5.34)
local sound = game.Workspace.ChargeUpBOOM
sound:Play()
local exppart = game.Workspace.CrimEXP
if exppart then
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
exppart.Material = "Neon"
local weld = Instance.new("WeldConstraint")
weld.Parent = workspace
weld.Part0 = exppart
weld.Part1 = character.HumanoidRootPart
if player.Character:FindFirstChild("Torso") == nil then --checks to see if player is r15
exppart.Position = Vector3.new (player.Character.LowerTorso.Position.X,player.Character.LowerTorso.Position.Y,player.Character.LowerTorso.Position.Z)
else --this is what happens if r6
exppart.Position = Vector3.new (player.Character.Torso.Position.X,player.Character.Torso.Position.Y,player.Character.Torso.Position.Z)
end
end
local tweenService = game:GetService("TweenService")
local part = game.Workspace.CrimEXP
part.BrickColor = BrickColor.new("Crimson")
local tweeningInformation = TweenInfo.new(
0.5, --length
Enum.EasingStyle.Cubic, --Easing Style
Enum.EasingDirection.InOut,
0, --Times repeated
false, --Reverse or no?
0 -- delay for tween
)
local partProperties = {
Size = Vector3.new(877.04,149.27,80.24);
Transparency = 1;
CanCollide = false
}
local tween = tweenService:Create(part,tweeningInformation,partProperties)
tween:Play()
wait (1)
exppart:Destroy()
exppart = nil
local part = game.Workspace.Part
part:Destroy()
part = nil
wait(2)
local character = plr.Character or plr.CharacterAdded:Wait()
local Anim = Instance.new("Animation")
Anim.AnimationId = 'rbxassetid://4906431432'
local LoadAnimation = character.Humanoid:LoadAnimation(Anim)
LoadAnimation:play()
if game.Workspace.ChargeUpBOOM.IsPlaying then
wait(2)
sound:Destroy()
sound=nil
return end
end)
