Here's the code I did (it's in a LocalScript in StarterPlayerScripts):
while wait(1) do local p = game.Players.LocalPlayer local m = p:GetMouse() if m.Target.Name == "Terrain" then print(m.Target) -- Here is where I want something like m.Target.TerrianMaterial else print(m.Target) end end
I want it to print "Stone" or "Mud" if the mouse target is pointing to "Stone" or "Mud" (just an example).
Is this possible?
Ignore my previous post, this works.
This one does it every 2 seconds.
local RunService = game:GetService("RunService") local p = game.Players.LocalPlayer local m = p:GetMouse() while true do wait(2) --change this to anything you like if m.Target and m.Target:IsA("BasePart") then print(m.Target.Material) end end
This one does it once:
local RunService = game:GetService("RunService") local p = game.Players.LocalPlayer local m = p:GetMouse() wait(2) --change this to anything you like if m.Target and m.Target:IsA("BasePart") then print(m.Target.Material) end