Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Idk But i broke it xDZZZZZZ?

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)

2 comments

0

where is the error?

0

It wont dmg anyone and it says Object value = nil something like dat

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.