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

This script is supposed to copy a persons name to a String Value, but it doesn't?

Basically when you click a button it saves your name to a String Value but it doesn't

local canspawn = script.Parent.CanSpawn

script.Parent.ClickDetector.MouseClick:connect(function(clicked)
	if canspawn.Value == true then
		local newrocket = game.ReplicatedStorage["Suicide Rocket"]:Clone()
		newrocket.Parent = game.Workspace
		newrocket:MoveTo(Vector3.new(-11.289, 1.092, 4.096))
		newrocket.Name.Value = clicked
		canspawn.Value = false
	end
end)

The error is: Workspace.Spawn A Rocket!.Head.Spawner:8: attempt to index field 'Name' (a string value)

5 comments

0

dude.... it is suppose to be either newrocket.Name or newrocket.Value

0

It's newrocket.Value not newrocket.Name.Value

0

I found out why it isn't working now. There is a string value in the clone called Name but the script is getting confused on which one to go by. But thank you all for your awnsers!

0

Why make a value in the world if you can just make a variable for the script?

0

Well I have two scripts that communicate with each other, if I had a variable, the other script wouldn't be able to read it.

1 answer

You're trying to access a string value's non-existing string value.

newrocket.Name.Value

Names don't have values or properties. They're just strings. If you only want to access a path to the name just remove .Value. Otherwise, take off .Name.

If you want it to put the value as the player's name then set the .Value not that incorrect way of accessing Value.

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