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

What does this error mean?

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

✓ Accepted answer
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)

4 comments

0

Thanks. I'm a bit new to scripting.

0

I have one more question. Why is it local and what does local mean?

0

local means it is only available in the specific scope. More Info: http://www.lua.org/pil/4.2.html

0

Local variables are also more efficient, so use them whenever you can.

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