When I test this when starting a server, it doesnt seem to work. I have NO clue why...
Here's how it works, in starter GUI there is a local script called "Gun" that creates a part, makes workspace its parent, and places the raycasting script (Which does damage) in the part. Keep in mind, "Gun" is a Local Script, and the raycasting script inside called "Raycast" is a normal script.
I TRIED USING A LOCAL SCRIPT, STILL DOESNT WORK. THE SCRIPT IS FULLY FUNCTIONAL
Here's the script:
local User
local Bullet = script.Parent
local LastPos = Bullet.Position
local RS = game:GetService("RunService").RenderStepped
while true do
local NewRay = Ray.new(LastPos, Bullet.Position - LastPos) --This casts a ray from the LastPos to the Bullet's current position
local H, P = game.Workspace:FindPartOnRay(NewRay, User)
local Human = H and H.Parent and H.Parent:FindFirstChild("Humanoid")
if Human then
local vPlayer = script.Parent.Owner.Value
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = script.Parent
tagHumanoid(Human)
Human:TakeDamage(10)
print("Hit")
untagHumanoid(Human)
script:Destroy()
end
LastPos = Bullet.Position --This resets the LastPos to the bullet's current position
RS:wait() --This waits for the RenderStepped event to fire, which is once every 1/60th of a second
end
function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = script.Parent:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end

2 comments
Yea... I'm trying to bypass the "Tool" system. It's all scripted in the starter pack. Gun is not the name of the part, its a script that copies Raycast and places it into the brick. What raycast does is ever 1/60 second it sends a raycast from the bullets last position and current position to take damage of a object who has a humanoid in it when detected.
Something I just noticed, I copied and un-disabled the script. I added a print function in the while loop, and it seems that the while loop wont even execute (Having removed the other tagging functons)