Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont the char set on fire?

Asked by 5 years ago

Okay, so I made a fireball script that essentially burns any player it touches, however when the fireball makes contact with the player, an error shows up in huge quantities, and the player doesn't burn.

Note: The test subject for the fireball is a dummy

Error:12:24:31.510 - Workspace.Dummy.Regenerating Pad.Fire.Spread:7: attempt to perform arithmetic on field 'Size' (a userdata value) 12:24:31.510 - Stack Begin 12:24:31.511 - Script 'Workspace.Dummy.Regenerating Pad.Fire.Spread', Line 7 12:24:31.512 - Stack End

Script:

game.ReplicatedStorage.Fireball.OnServerEvent:connect(function(player, mousehit)
local char = game.Players[player.Name].Character
 local hum = char.Humanoid 
 local root = char.HumanoidRootPart




 local fireball = Instance.new("Part",workspace)
 local fire = game:GetService("ServerStorage").Fire
 fireball.Anchored = false
 fireball.CFrame = root.CFrame * CFrame.new(0,1,-4)
 fireball.Size = Vector3.new(2,2,2)
 fireball.Material = Enum.Material.Neon
 fireball.BrickColor = BrickColor.new("Deep orange")
 fireball.Shape = Enum.PartType.Ball
 fire:Clone().Parent = fireball




local bv = Instance.new("BodyVelocity")
 bv.MaxForce = Vector3.new(1e8,1e8,1e8)
 bv.Velocity = Vector3.new(0,0,0)
 bv.Parent = fireball
 ten = true
 local tween = game:GetService("TweenService")
 local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,10,true,0)
 local tweenproperty = {Size = Vector3.new(5,5,5)}
 local tweenrun = tween:Create(fireball,tweeninfo,tweenproperty)
 tweenrun:Play()
 bv.Velocity = mousehit.lookVector*50
 game.Debris:AddItem(fireball, 10)

fireball.Touched:connect(function(hit)
 if not ten then return end
 ten = false
 local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
 if ehum and ehum ~= hum then
  fireball.CanCollide = false
  ehum:TakeDamage(10)
local debrisService = game:GetService("Debris")
local fire = game:GetService("ServerStorage"):FindFirstChild("Fire")
    for _, v in pairs(hit.Parent:GetChildren()) do
        if v:IsA("BasePart") then 
            if not v:FindFirstChild("Fire") then
                local fireClone = fire:Clone()
                fireClone.Parent = v
                debrisService:AddItem(fireClone, 5) -- removes the object in 5 seconds

end
end 
end
for i = 1, 10 do 
    hit.Parent.Humanoid:TakeDamage(1)
    wait(0.5)
end
  elseif hit.Parent == char then
  return nil
  elseif hit.Anchored  == true and hit.CanCollide == true then
  for i=1,50 do
   local part = fireball:clone()
   part.Size = Vector3.new(0.5,0.5,0.5)
   part.CFrame = fireball.CFrame
   part.CanCollide = false
   --part.BodyVelcoity.MaxForce = Vector3.new(1e8,0,1e8)
   part.Fire.LockedToPart = false
   part.BodyVelocity.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30))
   part.Parent = game.Workspace
   game.Debris:AddItem(part,1)

end 
fireball:Destroy()
ten = true
end
end)
end)

Fire spread script --Made by roblox

function Spread(part)
    check = part:findFirstChild("Fire")
        if check == nil then 
    script.Parent:Clone().Parent = part

        elseif check ~= nil then
    check.Size = check.Size + 1000000
    check.Heat = check.Heat  +1000000
    end
end


script.Parent.Parent.Touched:connect(Spread)

0
You already posted this question. OBenjOne 190 — 5y
0
Can't add a constant to Vector3 (the check.Size part). Try adding a Vector3 instead? (e.g. Vector3.new(100, 100, 100) ) ScrewDeath 153 — 5y
0
@Ben He didn't post the spread script so it probably got removed for not enough info ScrewDeath 153 — 5y
1
Fire might not have size as a number but a vector3 OBenjOne 190 — 5y
View all comments (4 more)
0
Oh OBenjOne 190 — 5y
0
Usually they will just ask for the script not delete the question. OBenjOne 190 — 5y
0
I want to learn thats why DominousSyndicate 41 — 5y
0
But also like i said, this is a roblox script so I don't know how to make a permanent edit to it, spread is found in fire when a new instance is made DominousSyndicate 41 — 5y

Answer this question