-
What do you want to achieve?
Okay so for my animal survival game I got a grab meat and drop meat system working. Well it was working until a few days ago I realized that when you drop the meat it falls through the world DESPITE having CanCollide and CanTouch be set to true, I don’t know what seems to cause this issue as I haven’t touched the script ever since I made this system. -
What solutions have you tried so far?
Tried using a part instead of a MeshPart, didn’t work other than that I only have assumptions. One would be that it could be because of the performance of the game, as it works fine with 900 MB’s of the game’s memory usage. It is now at approximately 1300 MB’s of memory usage and the system uses quite a lot of RemoteEvents/Functions, is that why it falls through the world? The meat seems to drop slower for 0.5 seconds and just vanishes.
Here’s two videos for comparison on Streamable:
How it used to work:
External MediaHow it works now:
External MediaAny help appreciated!
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
ServerScript inside ServerScriptService
-----
local CanThrowBlock = false
local pickedup = game.ReplicatedStorage.Picked
local function Takeblock(plr, block)
local weld = Instance.new("Weld")
local char = plr.Character
local jaw = char:WaitForChild("Jaw")
-----
local humanoid = char:WaitForChild("Humanoid")
local Carnivore = humanoid:GetAttribute("Carnivore")
local Herbivore = humanoid:GetAttribute("Herbivore")
local Omnivore = humanoid:GetAttribute("Omnivore")
if Carnivore == true or Omnivore == true and pickedup.Value == false then
block.Anchored = false
weld.Parent = block
weld.Part0 = block
weld.Part1 = jaw
block.CFrame = jaw.CFrame
block.Position = block.Position --+ jaw.CFrame.LookVector
weld.Name = "BlockWeld"
--block.Grab.MaxActivationDistance = 0
wait(1)
CanThrowBlock = true
pickedup.Value = true
end
---------
end
local function ThrowBlock(plr, block)
if CanThrowBlock == true and pickedup.Value == true then
local weld = block:WaitForChild("BlockWeld")
if weld:IsA("Weld") then
weld:Destroy()
pickedup.Value = false
--wait(0.5)
--block.Anchored = true
--block.Grab.MaxActivationDistance = 32
end
CanThrowBlock = false
pickedup.Value = false
end
end
game.ReplicatedStorage.TakeBlock.OnServerEvent:Connect(Takeblock)
game.ReplicatedStorage.ThrowBlock.OnServerEvent:Connect(ThrowBlock)
local CanThrowBlock = false
local function Takeblock(plr, block)
block.Anchored = false
local weld = Instance.new("Weld")
local Char = plr.Character
local Torso = Char:WaitForChild("Torso")
weld.Parent = Torso
weld.Part0 = Torso
weld.Part1 = block
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
LocalScript inside the character:
lua
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharachterAdded:Wait()
local uis = game:GetService("UserInputService")
local hum = char:WaitForChild("Humanoid")
local CanGrabBlock = true
local function Block(plr, block)
if CanGrabBlock == true then
CanGrabBlock = false
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)
wait(1)
CanGrabBlock = true
end
end)
end
end
game.ReplicatedStorage.ClientBlock.OnClientEvent:Connect(Block)
Script inside the meat model:
script.Parent.ClickDetector.RightMouseClick:Connect(function(plr)
game.ReplicatedStorage.ClientBlock:FireClient(plr, script.Parent)
end)