I'm trying to make a script where whenever you press a key, it launches a fireball. To be honest, the script and localscripts work, but I'm trying to make something in the script where whenever the boolvalue is true, it activates the other fireball. For example, if the green fireball boolvalue is true, and the other fireballs' boolvalue are false, the green fireball launches. I'm trying to make that, but it won't work. It only works when the green fireball's boolvalue is automatically true, and that it won't work when I maunally turn on the boovalue to true, and disable the other fireballs' boolvalue. Also there are no errors. Help? (also, even if you disable the fireball value, it still fires? and tried repeat wait() until, still no work.)
I only have two fireballs so far, you can see both scripts:
--GREEN FIREBALL SCRIPT--
--// Services \\--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService('Debris')
--// Variables \\--
local Remote = ReplicatedStorage.RemoteEvents.GreenFireBallEvent
local FireBall = ReplicatedStorage.Parts.GreenFireBall
--// Settings \\--
local Damage = 24.25
local ServerDebounces = {}
Remote.OnServerEvent:Connect(function(plr, Mouse)
if not ServerDebounces[plr] then
ServerDebounces[plr] = true
local Char = plr.Character or plr.CharacterAdded:Wait()
if plr.FireBalls.GreenFireBall.Value == true then -- Need help on.
local FireBallClone = FireBall:Clone()
FireBallClone.CFrame = Char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
FireBallClone.Parent = workspace
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.Velocity = Mouse.lookVector
BodyVelocity.Parent = FireBallClone
spawn(function()
for i = 0, 1000 do
wait()
FireBallClone.Size = FireBallClone.Size + Vector3.new(0.07,0.07,0.07)
BodyVelocity.Velocity = Mouse.lookVector*i
end
end)
ServerDebounces[plr] = false
Debris:AddItem(FireBallClone, 10)
local Debounce = true
FireBallClone.Touched:Connect(function(h)
if h.Parent:FindFirstChild('Humanoid') and h.Parent.Name ~= plr.Name and Debounce then
Debounce = false
local Enemy = h.Parent.Humanoid
Enemy:TakeDamage(Damage)
FireBallClone.Transparency = 1
BodyVelocity:Destroy()
FireBallClone.Effect.Speed = NumberRange.new(8,8)
wait(1)
FireBallClone.Effect.Enabled = false
wait(1)
FireBallClone:Destroy()
wait(3)
Debounce = true
end
end)
end
end
end)
--NORMAL FIREBALL SCRIPT--
--// Services \\--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService('Debris')
--// Variables \\--
local Remote = ReplicatedStorage.RemoteEvents.FireBallEvent
local FireBall = ReplicatedStorage.Parts.FireBall
--// Settings \\--
local Damage = 13.5
local ServerDebounces = {}
Remote.OnServerEvent:Connect(function(plr, Mouse)
if not ServerDebounces[plr] then
ServerDebounces[plr] = true
local Char = plr.Character or plr.CharacterAdded:Wait()
if plr.FireBalls.NormalFireBall.Value == true then -- Help?
local FireBallClone = FireBall:Clone()
FireBallClone.CFrame = Char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
FireBallClone.Parent = workspace
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.Velocity = Mouse.lookVector
BodyVelocity.Parent = FireBallClone
spawn(function()
for i = 0, 1000 do
wait()
FireBallClone.Size = FireBallClone.Size + Vector3.new(0.07,0.07,0.07)
BodyVelocity.Velocity = Mouse.lookVector*i
end
end)
ServerDebounces[plr] = false
Debris:AddItem(FireBallClone, 10)
local Debounce = true
FireBallClone.Touched:Connect(function(h)
if h.Parent:FindFirstChild('Humanoid') and h.Parent.Name ~= plr.Name and Debounce then
Debounce = false
local Enemy = h.Parent.Humanoid
Enemy:TakeDamage(Damage)
FireBallClone.Transparency = 1
BodyVelocity:Destroy()
FireBallClone.Effect.Speed = NumberRange.new(8,8)
wait(1)
FireBallClone.Effect.Enabled = false
wait(1)
FireBallClone:Destroy()
wait(3)
Debounce = true
end
end)
end
end
end)

2 comments
I don't completely understand what you are trying to say, are you having a problem with the event not firing or the fireball not firing? Or the fireball values not working correctly?
I'm trying to say, why won't the green fireball launch when I launched it? When I manually turn the green fireball bool value to true, for some odd reason, it wont launch. But when I set the value to true automatically from the start, it launches the green fireball.