So uhm, it's been months since i last posted here. Hi, hello, i am not dead.
Months ago my very terrible battle system used to work, but when i tried to work on it some more today, well uh, lets say it broke.
I literally did nothing, i just went to test it before continuing anything and it flat out broke.
!!!WARNING!!!
If you have years of experience in scripting the next image may be disturbing
If you wish to continue, then wow you are a brave one
This is the script:
--Variables
local parts = game.Workspace.Parts:GetChildren()
local Players = game:GetService("Players")
local Dummy = game.Workspace.Dummy
local DummyHumanoid = Dummy.Humanoid
local debounce = false
local player = Players.LocalPlayer
local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local FadeInFrame = script.Parent.Parent.FadeInUI.FadeInFrame
local attacks = require(script.Attacks)
--Battle Loop
for i, v in pairs(parts) do
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.FadeInUI.Enabled = true
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
v:Destroy()
FadeInFrame.BackgroundTransparency = 1
for k = 1,100 do
FadeInFrame.BackgroundTransparency -= 0.1
wait(0.3)
if FadeInFrame.BackgroundTransparency == 0 then
break
end
end
script.Parent.Parent.FadeInUI.Enabled = false
script.Parent.Enabled = true
Character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.TpPart.CFrame + Vector3.new(0,1,0)
if script.Parent.Enabled == true then
if script.Parent.AtkSelector.Punch.MouseButton1Click then
script.Parent.AtkSelector.Punch.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
DummyHumanoid.Health = DummyHumanoid.Health - 50
local function typeText(text)
for i = 1, #text do
script.Parent.DialogueLabel.Text = string.sub(text, 1, i)
wait()
end
wait(1.5)
script.Parent.DialogueLabel.Text = ""
end
if DummyHumanoid.Health <= 0 then
typeText("You won!")
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 40
script.Parent.AtkSelector.Punch.Visible = false
script.Parent.AtkSelector.Cancel.Visible = false
script.Parent.Enabled = false
DummyHumanoid.Health = 100
wait(3)
debounce = false
else
script.Parent.AtkSelector.Visible = false
script.Parent.AtkSelector.Punch.Visible = false
script.Parent.AtkSelector.Cancel.Visible = false
script.Parent.MagicSelector.Visible = false
wait(1)
typeText("This is the core battle system")
typeText("Isn't this cool???")
typeText("No??")
typeText("Welp, I tried")
attacks.AttackOne()
Humanoid.Died:Connect(function()
typeText("Ded")
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 40
script.Parent.AtkSelector.Punch.Visible = false
script.Parent.AtkSelector.Cancel.Visible = false
script.Parent.Enabled = false
DummyHumanoid.Health = 100
debounce = false
end)
wait(1)
script.Parent.AtkSelector.Visible = true
script.Parent.MagicSelector.Visible = true
wait(3)
debounce = false
end
end
end)
end
end
end
end)
end
Now, i know it's terrible but cope with me here.
Basically the part where it flat out stops working is:
FadeInFrame.BackgroundTransparency = 1
for k = 1,100 do
FadeInFrame.BackgroundTransparency -= 0.1
wait(0.3)
if FadeInFrame.BackgroundTransparency == 0 then
break
end
end
script.Parent.Parent.FadeInUI.Enabled = false
The FadeInFrame actually starts appearing, the screen becomes white and it all seems to work. But then, it just stays there.
The screen remains white, you can't move and you never get teleported to where you need to be.
For the love of god please help

2 comments
BackgroundTransparency: 1 (hidden), 0(shown). Add instead of subtracting.9mze
Turns out, the system works, the transition actually happens and it is quite smooth but eh, it takes really long to teleport me to where it needs to and i have no idea why that happens, no matter how terrible the script is it used to work like a charm.