Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does this error mean?

Asked by 9 years ago

I'm making a script where when you touch the brick, it will copy itself and put that copy somewhere else. When I do this I get the error "players is not a valid member of DataModel". What does this mean? Here's the script:

Brick = game.Workspace.Part

function OnTouched(Part)
    if game.players:GetPlayerFromCharacter(script.Parent)then
        clone(Brick, Vector3.new(-33, 6.59, -35))
    end
end

script.Parent.Touched:connect(OnTouched)

1 answer

Log in to vote
2
Answered by
2eggnog 981 Moderation Voter
9 years ago
Brick = game.Workspace.Part

function OnTouched(Part)
    if game.players:GetPlayerFromCharacter(Part.Parent) then
    local clone = Brick:Clone()
    clone.Position = Vector3.new(-33, 6.59, -35)
    clone.Parent = Workspace
    end
end

script.Parent.Touched:connect(OnTouched)

0
Thanks. I'm a bit new to scripting. notes4u99 65 — 9y
0
I have one more question. Why is it local and what does local mean? notes4u99 65 — 9y
0
local means it is only available in the specific scope. More Info: http://www.lua.org/pil/4.2.html Lacryma 548 — 9y
0
Local variables are also more efficient, so use them whenever you can. Perci1 4988 — 9y
Ad

Answer this question