Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I solve this? It isnt printing when it hits something

Asked by 2 years ago
local tool = script.Parent
local rf = game.ReplicatedStorage.remotes:WaitForChild("bullet")

local shooting = false
tool.Activated:Connect(function()
    if shooting == false then
        shooting = true
        local player = game.Players:GetPlayerFromCharacter(tool.Parent)
        local mousehitvec = rf:InvokeClient(player)
        print("ez")
        local rayparams = RaycastParams.new()
        rayparams.FilterType = Enum.RaycastFilterType.Blacklist
        local raynew = workspace:Raycast(tool.Pointgun.Position, mousehitvec, rayparams)
        print("not ez")
        if raynew then
            print("The thing that the ray touched was " .. raynew.Instance:GetFullName())
            print("not ez") 
        else print("u bad iam")
            print("not ez") 
        end
        wait(1) 
        shooting = false
    end
end)
0
Does the tool work otherwise? I am Meaning does it still work even tho the print doesn't work? theking66hayday 841 — 2y
0
Sorry for my bad explanation, resuming the script works until the if raynew. It always print the thing after else EVEN if I shoot on a part or something else. naninholeo 0 — 2y

Answer this question