Still have questions? Join our Discord server and get real time help.
Log in to vote

Making a script that makes rocks fall on a player?

Asked by 1 year ago

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 ="StringValue")
    getp.Value = tostring(v.Name)
    getp.Parent = game.Workspace

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 +,40,0)
            p.Anchored = false

1 answer

Log in to vote
Answered by
Denny9876 1186 Moderation Voter
1 year ago

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”.

thank winner208 74 — 1y

Answer this question