Player = game.Players.LocalPlayer
	Cursor = Player:GetMouse()
CursorState = nil
Target = nil

Cursor.Button1Down:Connect(function()
	CursorState = "Down"
	repeat
		game:GetService("RunService").Stepped:Wait()
		local Hit = Cursor.Hit
		if not Cursor.Target == nil and Cursor.Target:IsA("Part") and Cursor.Target.Parent == workspace.Blocks then
			if not Target:FindFirstChild("Lev") then
				local Lev = Instance.new("BodyPosition",Target)
				Lev.Position = Hit
			end
			local Target = Cursor.Target
			print(Target.Name)
		end
	until CursorState == "pickup"
end)

Cursor.Button1Up:Connect(function()
	CursorState = "drop"
	if not Target == nil then
		Target.Lev:Destroy()
		local player = Player
		local droporpickup = CursorState
		game.ReplicatedService.ControlRequest:FireServer(player,Target,droporpickup)
	end
end)

I'm trying to detect when I hold click for my custom grab script, I cannot tell if it's working because it won't detect the cursor's target Does anyone have a simple solution to this?

2 comments

0

Can you provide what the results looks like? I have no idea what you're even talking about.

0

Also, you never set your CursorState to "pickup"