How to make a AI that can detect player like entry point

In some cases, localscript is better than serverscript, like in the 30-40% of the scripting-things, but most of the games mostly run on serverscripts.

yea I know as server-scripts are not at all vunerable to hackers/exploiters but for this game I am just trying to change the theme of my UI which I made. And as I said Inside a function it does print but it doesnt change the color. For the script it does! but for me nope and the script is a local script. now all that you explained I get it… ish but uhh can you tell me a way around? like not using functions? this is how my way around looks rn but as you guessed (I think) it doesnt work

local Themes = {
	Girl = {
		["P"] = Color3.fromRGB(232, 65, 24),
		["S"] = Color3.fromRGB(194, 54, 22),
		["T"] = Color3.fromRGB(131, 149, 167)
	},
	Boy = {
		["P"] = Color3.fromRGB(39, 60, 117),
		["S"] = Color3.fromRGB(25, 42, 86),
		["T"] = Color3.fromRGB(131, 149, 167)
	},
}

local Gender = Instance.new("StringValue")

local function ChangeTheme()
	if Gender.Value == "" then return end
	for i,v in pairs(game.Players.LocalPlayer.PlayerGui:GetDescendants()) do
		if v:IsA("StringValue") then
			if v.Name == "P" then
				v.Parent.BackgroundColor3 = Gender["P"]
			elseif v.Name == "S" then
				v.Parent.BackgroundColor3 = Gender["S"]
			elseif v.Name  ==  "Tri" then
				v.Parent.BackgroundColor3 = Gender["T"]
			end
		end
	end
end

script.Parent.Menu.Back.Gender.Male.MouseButton1Click:Connect(function()
	Gender.Value = "B"
end)
script.Parent.Menu.Back.Gender.Female.MouseButton1Click:Connect(function()
	Gender.Value = "G"
end)

for i=1,100 do
	ChangeTheme()
	print(Gender.Value)
	wait(1)
end

If you click the button, but it doesn’t print out anything, it must be the script. If the script is local, copy the code and past it into a normal script, if it’s serverscript then change it into a local, but if you click it but no print, it means either the button1click is bad or the scripttype is not fine. May try MouseButton1Up

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.