Have u spelt everything correctly? and what is the object hit/raycast hit?, mind sharing your script.
Maybe the function doesn’t trigger…
Use prints in various places, wherever the code doesnt execute below means there is a error, just not printing.
Is it at a local script? It wont work if it isnt.
If it is a local script, then where is it located?
its local…
kjgfrhgfmdhgfgfdjfd
located in startercharacter scripts
it actually generates the part it just doesn’t detect when its touching a part with a humanoid in the same group
Print something at the start of the script
im confused?? the whole script works except for the part when its supposed to detect when touching a part in the same group with a humanoid named zombie
Can you copy and paste the entire script?
local player = game:GetService(“Players”).LocalPlayer
local Character = player.Character
local mouse = player:GetMouse()
local bulletDamage = 25
mouse.Button1Down:Connect(function()
local Raycasthit = Instance.new(“Part”)
Raycasthit.Parent = game.Workspace
Raycasthit.BrickColor = BrickColor.Red()
Raycasthit.Anchored = true
Raycasthit.Archivable = true
Raycasthit.Size = Vector3.new(1, 1, 1)
Raycasthit.Position = mouse.Hit.Position
print(Raycasthit.Position)
Raycasthit.Touched:Connect(function(objectHit)
local human = objectHit.Parent:FindFirstChild(“Zombie”)
if human then
print(“e”)
end
end)
end)
The humanoid needs to be called “Zombie” to it to work.
Can you put it in a code block?
print("This a Code Block!")
the humanoid is named zombie??
local player = game:GetService("Players").LocalPlayer
local Character = player.Character
local mouse = player:GetMouse()
local bulletDamage = 25
mouse.Button1Down:Connect(function()
local Raycasthit = Instance.new("Part")
Raycasthit.Parent = game.Workspace
Raycasthit.BrickColor = BrickColor.Red()
Raycasthit.Anchored = true
Raycasthit.Archivable = true
Raycasthit.Size = Vector3.new(1, 1, 1)
Raycasthit.Position = mouse.Hit.Position
print(Raycasthit.Position)
Raycasthit.Touched:Connect(function(objectHit)
local human = objectHit.Parent:FindFirstChild("Zombie")
if human then
print("e")
end
end)
end)
Try placing the script inside StarterGui.
Also, don’t put Raycast.Touched inside mouse.Button1Down
both solutions don’t make a difference
it spawns the cube at the mouse hits location but still doesn’t detect when touching a humanoid