Hello! I was researching about player input and i tried a script
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local function onMouseClick()
print(player.Name .. " clicked at position: " .. mouse.Hit.p)
if mouse.Target then
print("Clicked part: " .. mouse.Target:GetFullName())
else
print("No part clicked")
end
end
mouse.Button1Down:Connect(onMouseClick)
This script is a local script and it was put in StarterPlayerScripts
When i was testing, the output said
Players.Nguyenlegiahung.PlayerScripts.LocalScript:6: attempt to concatenate string with userdata
I changed line 6 to
print(mouse.Hit.p) and it was working, but how do I concatenate this?
Hope you can help :D
Thanks for reading my bad English
Edit: I was able to fix it by doing
mouse.Hit.p.X..mouse.Hit.p.Y..mouse.Hit.p.Z
Is there a more efficient way to do this?
