ok, so I have a tool that makes an instance spawn. the new instance has a code which then damages all players who touch it. but that's the problem, since it spawns at the position of the player... I think you get the point.
local tool = script.Parent
local mouse
local debounce = false
local dmg = --set damage here
tool.Equipped:Connect(function(m)
mouse = m
end)
tool.Activated:Connect(function()
if mouse then
local Part = Instance.new("Part",workspace)
Part.Position = script.parent.Handle.Position
Part.Material = Enum.Material.Neon
Part.Size = Vector3.new(0.5,0.5,0.5)
Part.CanCollide = false
Part.Anchored = true
Part.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
debounce = true
h:TakeDamage(dmg)
wait(1)
end
debounce = false
end)
end
end)
I know I've been asking a lot of questions here but I just cant find the answer... it would also be appreciated if you could put the link to teach me about this kind of stuff. like in here: https://developer.roblox.com

2 comments
After making some of my own changes, It worked! at first it didn't but after a couple rounds of trial and error it worked, thanks bud!
well, kind of... while testing it didn't hurt the other player but well find a way.