Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making a script that makes rocks fall on a player?

So, when I put this code in, the output box just says "argument 1 missing or nil" at line 15 and I'm quite positive that there could possible be more errors. I personally Don't get what it's coming from, but here's my script. It makes 20 rocks spawn over the head of all players.

rock = script.Parent.Parent.Parent.rocky.Rock
for i, v in pairs(game.Players:GetChildren()) do
	getp = Instance.new("StringValue")
	getp.Value = tostring(v.Name)
	getp.Parent = game.Workspace
end


for i = 1,20 do
	local p = rock:Clone()
	p.Parent = script.Parent.Parent.Parent
	for i, v in pairs(game.Workspace:GetChildren()) do
		if v:IsA("StringValue") then
			local gname = v.Value
			local pl = game.Workspace:FindFirstChild(gname.Value)
			p.Position = pl.Position + Vector3.new(0,40,0)
			p.Anchored = false
		end
	end
end

1 answer

✓ Accepted answer

I think you typed something incorrectly. On line 14 “gname” is v.Value, but on line 15 you are trying to find the value of the value of v? Basically the script is thinking it’s trying to find v.Value.Value.

Simply just change “v.Value” on line 14 into “v”.

1 comment

0

thank

This discussion is preserved as it was. New answers, comments, and votes are closed.