Tried to create a gun script, for some reason this line in the code is an error. Dunno why, I checked the output and this popped up, I don’t exactly know what it means though.
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = (player.Character)
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(script.Parent.Handle.Position, (mousePos - script.Parent.Handle.Position)*300, raycastParams)
if raycastResult then
local hitpart = raycastResult.Instance
local model = hitpart:FindFirstAncestorOfClass("Model")
if model then
if model:FindFirstChild("Humanoid") then
model.Humanoid.Health - 30 --here is the error line
end
end
Use your default code, but add .Value to the end of the problem line, so it will look like:
local model = hitpart:FindFirstAncestorOfClass("Model")
if model then
if model:FindFirstChild("Humanoid") then
model.Humanoid.Health.Value - 30 --here is the error line
end
end