Dropping block issue

I decided to make this pick up block system that can, well simply pick up the block and drop it.

I want to make it so it does not fall off to void.

here is the video of the system
https://gyazo.com/c7937549e397be0dfa2fbfd65714dd02

well the issue here is clear, the pick-up has no issues whatsoever, but the issue is when you drop it, it falls off to void.
so what is the solution here?

i think the issue is the block doesnt get its cancollide property back when you drop it, can you send me the script?

ServerScriptService

local CanThrowBlock = false

local function Takeblock(plr, block)
	local weld = Instance.new("Weld")
	local char = plr.Character
	local torso = char:WaitForChild("Torso")
	weld.Parent = block
	weld.Part0 = block
	weld.Part1 = torso
	block.CFrame = torso.CFrame
	block.Position = block.Position + torso.CFrame.LookVector
	weld.Name = "BlockWeld"
	block.ClickDetector.MaxActivationDistance = 0
	block.CanCollide = false
	wait(1)
	CanThrowBlock = true
end

local function ThrowBlock(plr, block)
	if CanThrowBlock == true then
		local weld = block:WaitForChild("BlockWeld")
		if weld:IsA("Weld") then
			weld:Destroy()
			block.ClickDetector.MaxActivationDistance = 32
		end
		CanThrowBlock = false
		block.CanCollide = false
	end
end

game.ReplicatedStorage.TakeBlock.OnServerEvent:Connect(Takeblock)
game.ReplicatedStorage.ThrowBlock.OnServerEvent:Connect(ThrowBlock)

StarterGui:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local uis = game:GetService("UserInputService")
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script.GrabBlockAnim)
local CanGrabBlock = true

local function Block(plr, block)
	if CanGrabBlock == true then
		CanGrabBlock = false
		anim:Play()
		game.ReplicatedStorage.TakeBlock:FireServer(plr, block)
		uis.InputBegan:Connect(function(input, gameProcessedEvent)
			if input.KeyCode == Enum.KeyCode.T then
				game.ReplicatedStorage.ThrowBlock:FireServer(plr, block)
				anim:Stop()
				wait(1)
				CanGrabBlock = true
			end
		end)
	end
end

game.ReplicatedStorage.ClientBlock.OnClientEvent:Connect(Block)
game.Workspace.Blocks.block.CanCollide = false

block.CanCollide in the ThrowBlock() function is still false. Set it to true and you should be good to go.

3 Likes

Thank you! you just saved my issue it works as intended now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.