My script is a local script placed inside of a rig and what I need it to do is when a player right clicks, it spawns a part where the click happened.
The code is very flawed (although no errors occur) and I need some guidance on how to do this
local UserInputService = game:GetService("UserInputService")
local mouse = game.Players.LocalPlayer:GetMouse()
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.MouseRightButton then
local goal = Instance.new("Part")
goal.Position = mouse.x and mouse.y
goal.Anchored = true
goal.CanCollide = false
print("Right Click")
end
end)
** You are now Level 3! **