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

player:GetMouse().Hit doesn't work, why?

Asked by 6 years ago

I've tried to fix it so that it uses the mouse's hit, but it still doesn't work. It just says "attempt to index upvalue "mouse".

local remote = game:GetService("ReplicatedStorage"):FindFirstChild("ExploToolCreated")

remote.OnServerEvent:Connect(function(p,player,character,mouse)



    Tool.Activated:Connect(function()

        local hit = mouse.Hit

        hum:LoadAnimation(Anim):Play()
        local bomb = handle:Clone()
        Tool:Destroy()
        root.CFrame = CFrame.new(root.Position, root.Position + Vector3.new(hit.lookVector.x,0,hit.lookVector.z))
        local bv = Instance.new("BodyVelocity")
        bv.MaxForce = Vector3.new(1e8,0,1e8)
        bv.Velocity = hit.lookVector * 100
        bv.Parent = bomb
        bomb.Parent = workspace
    end)

If more code is needed I'll add more.

0
You can't pass a mouse, however, I believe it is passed in an argument in the .Activated event. hiimgoodpack 2009 — 6y
0
What you should do is pass mouse.Hit as the argument through the remote rather than mouse because I don't think you can pass userdata value through a remote or something like that. AmWrath 41 — 6y

Answer this question