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

<name>' expected near '"Name"' ?

I ran into this problem multiple times. Problem: ' expected near '"Name"'

Script:

p = game:GetService("Players").LocalPlayer game.Players.PlayerAdded:connect(function(player) if player.Name == "Capris_Succ" then local p = Instance.new("Part", workspace.npcs, Vector3.new(-139.8, 0.5, -190)) game.Workspace.npcs.Part."name" = SunnyD local p = Instance.new("IntValue", SunnyD) wait(0.5) game.Workspace.SunnyD.IntValue."name" = INT local p = Instance.new("IntValue", SunnyD) game.Workspace.SunnyD.IntValue."name" = itemV game.Workspace.SunnyD.INT.Value = 13 game.Workspace.SunnyD.itemV.Value = 6

    end

end )

I cannot fix this for the life of me. Any help will do.

2 comments

0

Use Code Blocks please, I cannot understand the script.

0

Code blocks please.

1 answer

To begin with, please format your code properly.

This includes indenting your code as well as putting it inside the Codeblock. The Codeblock is the symbol that has the text Lua on it. Place all your code inside the ~~~~~~~~~~~~~~~~~ line.

Secondly, your code makes zero sense.

What are you trying to do? Are you trying to insert a IntValue and why are you doing "Name" when it is simply Name??

The second parameter of Instance.new() is deprecated.

Deprecated items should be avoided. Especially the second parameter of Instance.new(). It can cause massive performance issues.

Lets take a look at your code and I will point out the errors.

p = game:GetService("Players").LocalPlayer 
game.Players.PlayerAdded:connect(function(player) 
	if player.Name == "Capris_Succ" then 
		local p = Instance.new("Part", workspace.npcs, Vector3.new(-139.8, 0.5, -190))
	    game.Workspace.npcs.Part."name" = SunnyD 
	    local p = Instance.new("IntValue", SunnyD) 
	    wait(0.5) 
	    game.Workspace.SunnyD.IntValue."name" = INT 
	    local p = Instance.new("IntValue", SunnyD) 
	    game.Workspace.SunnyD.IntValue."name" = itemV
	    game.Workspace.SunnyD.INT.Value = 13 
	    game.Workspace.SunnyD.itemV.Value = 6
	end
end)
Errors Fix
connect is deprecated Instead, use Connect
The second parameter of Instance.new() is deprecated. Parent the object separately in a new line.
Do not also add Vector3 values within the Instance.new() Again, write it in a separate line.
It is not "name" It is Name without Quotation Marks.
You did not add Quotation Marks for the INT It should be "INT" Instead.
Don't use same variable to create a new object Declare another variable instead.
This should not be done in Local Script Use Server Script Instead.

Here is the fix to your code. Hopefully that is what you wanted. Do keep in mind that this is a Server Script.

-- [Declaration Section]
local Player           = game:GetService("Players");
local Part, Val1, Val2;

-- [Processing Section]
local function Add_Stuff (G_Player)
	if G_Player.Name == "zafiruatest" then 
		Part           = Instance.new("Part");
		Part.Position  = Vector3.new(0, 0, 0); --Desired Position. 
		Part.Name      = G_Player.Name;
		Part.Parent    = workspace; --Put it in your desired location. 
		
		Val1           = Instance.new("IntValue");
		Val1.Name	   = G_Player.Name .. "INT";
		Val1.Value     = 13;
		Val1.Parent    = G_Player;
		
		Val2           = Instance.new("IntValue");
		Val2.Name      = G_Player.Name .. "ItemV";
		Val2.Value     = 6;
		Val2.Parent    = G_Player;
	end;
end;

-- [Connecting Section]
Player.PlayerAdded:Connect(Add_Stuff);

2 comments

0

how to make a table?

0

Tis a secret <3

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