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

how do i fix attempt to index local 'mouse' (a nil value)?

Asked by 5 years ago
local grov = true
game.ReplicatedStorage.ICe.OnServerEvent:Connect(function(player,mouse)
    local char = player.Character
local  x = Instance.new("Part",workspace)
    local d = Instance.new("BodyVelocity",x)
x.Anchored = true
    d.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
    x.BrickColor = BrickColor.new("Toothpaste")
    x.Material = "Neon"
  x.Size = Vector3.new(1.26, 0.64, 0.72)
x.Position = char.Head.Position +Vector3.new(1,0,0)
  x.CanCollide = false
x.Anchored = false
    d.Velocity = mouse.Hit.LookVector * 99
    x.Touched:Connect(function(Hit)
        if Hit:IsA("BasePart") then
        local c = Instance.new("Explosion")
        c.Position = x.Position
        c.Parent = workspace
        end
    end)
end)

0
This is a regular script yes? You’ll need a local script along with the regular script to get the players mouse and ref RepStorage ABK2017 406 — 5y
0
its a local script helleric -3 — 5y
0
why do you use on server event in a local script? Also, you  Instance.new stuff in the client  only shows on the client theking48989987 2147 — 5y

Answer this question