local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(key)
Mouse.Button1Down:connect(function()
local Char = Player.Character
local Origin = Char:FindFirstChild("Torso").Position
local ray = Ray.new(Origin * 500)
local part, hitPosition = workspace:FindPartOnRay(ray, Char)
if part.Parent == "Grid" then
print(part.Name)
end
end)
end)
I can't seem to get through this. I've basically set up a grid of 36 squares, put them in a Model named "Grid" I want to create a script that when the player clicks, if it's one of the grid squares they clicked, print the name of the grid square.

2 comments
Line 7 try part.Parent.Name == "Grid".
Players.Ruves.Backpack.LocalScript:17: attempt to index local 'part' (a nil value) 12:26:43.790 - Stack Begin 12:26:43.791 - Script 'Players.Ruves.Backpack.LocalScript', Line 17 12:26:43.791 - Stack End