For some reason, my script doesnt work, its in a local script, and script.parent does contain that instance, I have never seen anything like this, the instance in case is a vector3 value, It is inside of a tool
local Mouse = game.Players.LocalPlayer:GetMouse()
local Position = Mouse.Hit.Position
script.Parent.gg.Value = Position
I think it has to do something with the “gg” part. Is it unanchored and falling through the map? If not do
‘print(Position)’ to see if the script is actually working.
local players = game:GetService("Players")
local client = players.LocalPlayer
local mouse = client:GetMouse()
local tool = script.Parent
local value = script.Parent.gg
tool.Activated:Connect(function()
value.Value = mouse.Hit.Position
end)
You can try this script to change the vector3 value whenever you click with the tool.
This code would constantly update the mouse’s vector3 every frame when the tool is equipped
local players = game:GetService("Players")
local runService = game:GetService("RunService")
local client = players.LocalPlayer
local mouse = client:GetMouse()
local tool = script.Parent
local value = script:WaitForChild("Value")
local equipped = false
runService.RenderStepped:Connect(function()
if equipped then
value.Value = mouse.Hit.Position
end
end)
tool.Equipped:Connect(function()
equipped = true
end)
tool.Unequipped:Connect(function()
equipped = false
end)