I'm trying to make the player to drop cloned meat from ReplicatedStorage at death, but it's not working, there's something wrong I don't know where it is? Here is the script.

local Food = game.ReplicatedStorage.Meat2
local spawner = game.Players.LocalPlayer.Character.Torso
local BloodCount = 0 

function onPlayerDied(dead)
			head = script.Parent.Head
			local RandomBlood = math.random(4, 4)
			MaxBlood = RandomBlood
			while true do
			if BloodCount < MaxBlood then
			BloodCount = BloodCount +1
			local Clone = Food:clone()
			Clone.CFrame = spawner.CFrame
			Clone.Parent = game.Workspace
			local ClickDetector1 = Instance.new("ProximityPrompt")
			ClickDetector1.MaxActivationDistance = 10
			ClickDetector1.ActionText = "Meat"
			ClickDetector1.ObjectText = "20/1 sec"
			ClickDetector1.HoldDuration = 1
			ClickDetector1.Parent = Clone
			local Script1 = script.Script:clone()
			Script1.Disabled = false
			Script1.Parent = Clone
			local WaitTime = 0
			if WaitTime == 0 then
			wait(0)
			end
			end
			if BloodCount == MaxBlood then
			return end
			end
end

script.Parent.Humanoid.Died:connect(onPlayerDied)

1 comment

0

what type of script and where is it stored ?