This script damages any player that is hit by it, but if the player with the weapons stays still it instead passes through them without doing any damage...
local modelstuff = {} function ontouch(hit) if hit.Parent:FindFirstChild("Humanoid") then local model = hit.Parent local hum = hit.Parent:FindFirstChild("Humanoid") if modelstuff[model] then return else local def = hit.Parent:FindFirstChild("Defense").Value local dmg = script.Parent.Parent:WaitForChild("Attack").Value - def hum:TakeDamage(dmg) if hit.Parent:FindFirstChild("Bleed") then if hit.Parent:FindFirstChild("Streak") then else local streak = Instance.new("IntValue") streak.Parent = hit.Parent streak.Name = "Streak" end local st = hit.Parent:FindFirstChild("Streak") st.Value = st.Value + 1 hit.Parent:FindFirstChild("Bleed").Dmg.Value = hit.Parent:FindFirstChild("Bleed").Dmg.Value + 1 hit.Parent:FindFirstChild("Bleed").Time.Value = hit.Parent:FindFirstChild("Bleed").Time.Value + 1 local bled = hit.Parent:FindFirstChild("Head").Bleed bled.TextLabel.Text = "Bleed X".. st.Value else local bleed = game.ServerStorage.Effects.Bleed:Clone() bleed.Disabled = false bleed.Parent = hit.Parent end local h = hit.Parent:FindFirstChild("HumanoidRootPart") local bb = game.ServerStorage.Classes.BillboardGui:Clone() bb.Parent = h local txtlabel = bb:WaitForChild("TextBox") if dmg > 20 then txtlabel.TextColor3 = Color3.fromRGB(255,0,0) end txtlabel.Text = tostring(dmg) end modelstuff[model] = true wait(.5) modelstuff[model] = false end end script.Parent.DmgBox.Touched:Connect(ontouch)
Please help me, i cant script
it's because it only triggers when it's "TOUCHED" not when it's in that part
if you want to make it so if it's in the player part it still damages while not moving probably either use "FindPartsInRegion3" or a few scripts that check if parts left or go into a part and add that to the list THEN damage all the players in there with another script