Well, basically, i want to fire a event when player press T and their mouse.target.name == “WellPlacement” and its distance is within 7 studs.
It worked properly before (a bit buggy) but now it doesn’t work.
this is my local script:
local function onInputBegan(input, gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.T then
if player:DistanceFromCharacter(mouse.Target.Position) > 0 and player:DistanceFromCharacter(mouse.Target.Position) <= 7 then
print(mouse.Target)
if mouse.Target.Name == "WellPlacement"
or mouse.Target.Name == "Union1"
or mouse.Target.Name == "Union2"
or mouse.Target.Name == "Union3"
or mouse.Target.Name == "Union4"
or mouse.Target.Name == "TV_EnablerPart"
or mouse.Target.Name == "VaultPart"
or mouse.Target.Name == "Lock"
or mouse.Target.Name == "BedroomKeySlot"
or mouse.Target.Name == "SinkWater" then
local object = mouse.Target
re2:FireServer(object.Name)
elseif mouse.Target.Name == "Handle" then
local object = mouse.Target.Parent
re2:FireServer(object.Name)
end
end
end
end
UserInputService.InputBegan:Connect(onInputBegan)
I dont know what is happening, there is nothing called “Part” there. Any help would be appreciate.