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

How come my script says attempt to index boolean with 'Name'?

The error is 17:16:08.368 - Players.techingenius.PlayerGui.Shop.Bought:4: attempt to index boolean with 'Name' and I'm using a script, any help? It used to work

game.Workspace.Owned.ACR.Changed:Connect(function(player)
	if game.Workspace.Owned.ACR.Value == true then
		local Clone = game.ServerStorage.ACR:Clone()
		Clone.Parent = game.Workspace[player.Name]
	end
end)

4 comments

0

The changed parameter returns the property thats being changed, not the player.      game.Workspace.Owned.ACR.Changed:Connect(function(propertyBeingChanged)

0

Then how would I fix it?

0

Is this a LocalScript?

0

no

1 answer

The Changed event has a parameter of the property that's being changed.

So in this case, whenever the Value property changes, it's being referenced as "player".

I'm not so sure on how to fix this using a BoolValue.

You could use a StringValue and make it whenever no one own's it, it says "Unowned" if someone does own it, then it should say the player's name that owns it.

game.Workspace.Owned.ACR.Changed:Connect(function(property)
	if property == "Value" then
		if game.Workspace.Owned.ACR.Value ~= "Unowned" then
			local clone = game.ServerStorage.ACR:Clone()
			clone.Parent = game.Workspace[game.Workspace.Owned.ACR.Value]
		end
	end
end)

Something along the lines of this should work. But, you'll have to do checks to see if anyone doesn't own it, and if no one own's it, then change the value of it to "Unowned".

But, hope this somewhat helped! Feel free to select this as an answer if this helped!

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