I have some problem. My script can’t be enabled after it has been disable. I have use two script to use this. This is the first script.
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local StarterPlayerScripts = game.StarterPlayer:FindFirstChild("StarterPlayerScripts")
game.Players.PlayerAdded:Connect(function()
if StarterPlayerScripts:FindFirstChild("script") then
script.Disabled = true
end
end)
Second script.
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local StarterPlayerScripts = game.StarterPlayer:FindFirstChild("StarterPlayerScripts")
local Script = script.Parent.Script
game.Players.PlayerAdded:Connect(function()
if not StarterPlayerScripts:FindFirstChild("script") then
Script.Disabled = false
end
end)
Please tell me what is wrong. I dont know why it won’t enable.
Edit: The script is located in SSS (Server Script Service).
The script(the one you wrote) is disabled and forever will be disabled. Nothing will work then. I have no clue what your real intention is behind this.
Note script.Disabled.
It is as if you were to make the script deactivate itself without reactivation after attempting activating it from something that has been disabled.
game.Players.PlayerAdded:Connect(function(player)
if player.PlayerScripts:FindFirstChild("script") then
script.Disabled = true
end
end)
Anything (only scripts) in starter player scripts/ starter character scripts are replicated into player scripts
If this reply solved your problem, you can mark it as the solution.
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local StarterPlayerScripts = game.StarterPlayer:FindFirstChild("StarterPlayerScripts")
local Script = script.Parent.Script
game.Players.PlayerAdded:Connect(function()
if not StarterPlayerScripts:FindFirstChild("script") then
Script.Disabled = false
end
end)
I disable the script at the studio before it got launch.
Edit: The other script