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

Chatted Script Help?

Hello, I am working on a script that would allow the owner of a game say a in-game message and it will change the stats of the tycoons. It is a game owner command. Anyways this is what I got so far and it is not working.

a = game.Workspace["berezaa's Tycoon Kit"]
Users = {"CallMeDonaldTrump", "NameHere"}			
player=game.Players.LocalPlayer
player.Chatted:connect(function(msg)
if msg=="Owner" and player.Name==Users then
a["Bright red"].Cash.Value = 999999999
a["Bright green"].Cash.Value = 999999999
a["Bright blue"].Cash.Value = 999999999
a["Bright yellow"].Cash.Value = 999999999
end	
end)			

5 comments

1

Try avoid using other people's scripts unless you are learning from them, learning from and using are very different. The only thing that appears wrong with this script is nothing, I think the issue is that Cash and Value don't exist. There is this awesome tool called output which will most likely help you fix any errors or nullpointers(trying to access something that doesn't exist)

0

To view output go to view in the top bar of studio then click on the output button, you should also see many other things like explorer, properties, and more!

0

Well, I do have the output out and nothing showed up in it. However I did find the issue, I just removed the "and player.Name==Users" and "Users = {"CallMeDonaldTrump"} and it worked

0

ok cool, keep using other peoples scripts, thatll get you far in life

1

Lmaooooo

1 answer

It is best recommended to learn scripting and not work off of a model you found online. You could get infected or get a while true do end (A sample loop that can break your game.). One resource is here: https://developer.roblox.com/

Now, On line 5, you compared a string value with a table value full of strings. Of course, Names can't be tables.

If you want to check if a value given is in a table, there would be multiple options, but the main thing is that most would use a for loop. A for loop runs for a specific amount, be numbers or the amount in a list (or table). My version

function checkvalue(table1,val)
	for _,v in pairs(table1) do
		if v==val then
			return v
		end
	end
	return false
end

if checkvalue(table1,val) then
	print(checkvalue(table1,val))
else
	print('Can not find value.')
end

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