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

Sword script help?

I have been spending hours on my swords for my sword game, but I cannot understand where I have gone wrong with this script. Could anyone help me out by spotting where I have gone wrong?

When the player presses 'q' a sound is played and a red ball expands from the players torso killing anybody in its path.

I am not sure on how to do the killing part though. I could really use some help there.

This is what I have:

local sound = script.Parent.Handle.Sparta
local Tool = script.Parent;
enabled = true
function onButton1Down(mouse)
	if not enabled then
		return
	end

	enabled = false
	mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

	wait(.5)
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	enabled = true

end
function onEquippedLocal(mouse)
	
	mouse.KeyDown:connect(function(key)
		key=string.lower(key)
		if key=="q" then
			h = Tool.Parent
			if h.Humanoid.Health~=nil then
				sound:Play()
				Part = Instance.new("Part")
				Part.Parent = h.Torso
				Part.Shape = 1
				Part.Position = CFrame.new(h.Torso.Position)
				Part.Size = Vector3.new(5,5,5)
				Part.Color = BrickColor.Red()
				wait(0.5)
				Part.Size = Vector3.new(7,7,7)
				wait(0.5)
				Part.Size = Vector3.new(9,9,9)
				wait(0.5)
				Part.Size = Vector3.new(12,12,12)
				wait(0.5)
				Part.Size = Vector3.new(15,15,15)
				wait(0.5)
				Part.Size = Vector3.new(17,17,17)
				wait(0.5)
				Part.Size = Vector3.new(20,20,20)
				wait(1)
				Part:Destroy()				
				
				end
		end
		
	end)
end
	if mouse == nil then
		print("Mouse not found")
		return 
	end

	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)	
sp.Equipped:connect(onEquippedLocal)
Tool.Equipped:connect(onEquippedLocal)

1 answer

✓ Accepted answer

Maybe add a script in ReplicatedStorage that kills you then in your script add this on line 45

game.ReplicatedStorage.KillScript:clone().Parent  =  h.Torso.Part

In the kill script u can just use a lava brick script.

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