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

Idk But i broke it xDZZZZZZ?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

can you help me fix the script?

arrow = script.Parent
Owner = Instance.new("ObjectValue", arrow)
Owner.Value = script.Parent.Name
damage = 20
Hits = 0

function onTouched(hit)


    humanoid = hit.Parent:findFirstChild("Humanoid")
    if humanoid~=nil then
        if hit.Parent.Name ~= Owner.Value.Name then
      if Hits <= 3 then 
         humanoid.Health = humanoid.Health - damage
       Hits = Hits + 1
       --hit.Parent.Torso.CFrame = CFrame.new(hit.Parent.Torso.Position, arrow.Position)
       --hit.Parent.Torso.CFrame = CFrame.new(hit.Position)
       hit.Parent.Torso.CFrame = arrow.CFrame * CFrame.Angles(0, -3.14, 0)
       humanoid.Sit = true
      end
wait(0.5)
        explosion = game.Lighting.Bewm:clone()
        explosion.Position = hit.Position
        explosion.Mesh.Scale = Vector3.new(0.1, 0.1, 0.1)
        explosion.Parent = workspace
        wait()
        end
    end
    if hit.Name == "Blast" or hit.Name == "StrongBlast" and hit ~= arrow then
      Hits = Hits + 1
        wait(0.5)
        explosion = game.Lighting.Bewm:clone()
        explosion.Position = hit.Position
        explosion.Mesh.Scale = Vector3.new(0.1, 0.1, 0.1)
        explosion.Parent = workspace
        wait()
    end
end

arrow.Touched:connect(onTouched)

0
where is the error? woodengop 1134 — 9y
0
It wont dmg anyone and it says Object value = nil something like dat FearlessBiscuit 0 — 9y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

Your error is on line 3. An ObjectValue holds an Object, not a string. Simply remove the .Name from the end of that line and your code should work.

Ad

Answer this question