This is what I have on my script right now. What i want it to do is make the folder value be true only if the file this is activated. But when I run this in my game it instantly makes the folder value true. How do I fix this?
local this = script.Parent game.Players.PlayerAdded:connect (function(plr) local folder = Instance.new ("BoolValue",workspace) folder.Name = (plr.Name .. "click") if this.Activated then folder.Value = true end end)
You don't handle PlayerAdded from a LocalScript. Just use a LocalScript and use the LocalPlayer.
--LocalScript script.Parent.MouseButton1Click:Connect(function() print(game:GetService("Players").LocalPlayer.Name) end)
Organization is essential.
--Made by Lunatic_o -- I don't know if it will work. (I'm on mobile) local this = script.Parent this.Activated = false function CheckThis() if assert(this.Activated) then print("This is Activated") workspace.YoutFolder.Value = true end end game.Players.PlayerAdded:Connect(function(plr) local folder = Instance.new("BoolValue", workspace) folder.Value = false folder.Name = "YourFolder" end) this.Activated.Changed:Connect(CheckThis)