i am making a fnaf bot system which it will check which room it is in / what the value is set to and then get a random number between 1 and 20, if it is below or equals the bot level, the bot will move, if it isnt, it will try again, it will choose a random number depending on what room the bot currently is, it will move there and change the string value, hiding the old rig and showing the new one, and once it gets to the door and the door isnt closed it will kick the player out of the game. for some reason the StringValue doesnt always change and it will make the script break, if anyone has an answer please help me.
local poses = game.ReplicatedStorage.CalebPoses
local currentPose = workspace.Poses
local currentRoom = script.Parent.Value
local roomOption = nil
local botLevel = 20
local moveChances = nil
local doorCheck = workspace.RightDoor["RightDoorStatus"]
local attackOption = nil
currentRoom = "Start"
wait(math.random(5,10))
while task.wait(math.random(5,10)) do
moveChances = math.random(1,20)
if moveChances <= botLevel then
if currentRoom == "Start" then
roomOption = math.random(1,2)
if roomOption == 1 then
moveChances = nil
currentRoom = "Main Party Room"
poses.CalebMainPartyRoom.Parent = currentPose
currentPose.CalebIdle.Parent = poses
end
if roomOption == 2 then
moveChances = nil
currentRoom = "Parts And Service Door"
poses.CalebNearPartsAndServiceDoor.Parent = currentPose
currentPose.CalebIdle.Parent = poses
end
end
moveChances = math.random(1,20)
if moveChances <= botLevel then
if currentRoom == "Main Party Room" then
roomOption = math.random(1,5)
if roomOption == 1 or 2 or 3 then
moveChances = nil
currentRoom = "Main Party Room Stare"
poses.CalebMainPartyRoomStare.Parent = currentPose
currentPose.CalebMainPartyRoom.Parent = poses
end
if roomOption == 4 then
moveChances = nil
currentRoom = "Parts And Service Door"
poses.CalebNearPartsAndServiceDoor.Parent = currentPose
currentPose.CalebMainPartyRoom.Parent = poses
end
if roomOption == 5 then
moveChances = nil
currentRoom = "Party Room Hall"
poses.CalebPartyRoomHall.Parent = currentPose
currentPose.CalebMainPartyRoom.Parent = poses
end
end
moveChances = math.random(1,20)
if moveChances <= botLevel then
if currentRoom == "Parts And Service Door" then
roomOption = math.random(1,3)
if roomOption == 1 or 2 then
moveChances = nil
currentRoom = "Main Party Room"
poses.CalebMainPartyRoom.Parent = currentPose
currentPose.CalebNearPartsAndServiceDoor.Parent = poses
end
if roomOption == 3 then
moveChances = nil
currentRoom = "Parts And Service"
poses.CalebPartsAndService.Parent = currentPose
currentPose.CalebNearPartsAndServiceDoor.Parent = poses
end
end
moveChances = math.random(1,20)
if moveChances <= botLevel then
if currentRoom == "Main Party Room Stare" then
roomOption = math.random(1,4)
if roomOption == 1 or 2 or 3 then
moveChances = nil
currentRoom = "Hallway"
poses.CalebHallway.Parent = currentPose
currentPose.CalebMainPartyRoomStare.Parent = poses
end
if roomOption == 4 then
moveChances = nil
currentRoom = "Main Party Room"
poses.CalebMainPartyRoom.Parent = currentPose
currentPose.CalebMainPartyRoomStare.Parent = poses
end
end
moveChances = math.random(1,20)
if moveChances <= botLevel then
if currentRoom == "Hallway" then
roomOption = 1
if roomOption == 1 then
moveChances = nil
currentRoom = "Door"
poses.CalebDoor.Parent = currentPose
currentPose.CalebHallway.Parent = poses
end
end
if currentRoom == "Door" then
wait(7,10)
if doorCheck == 1 or true then
moveChances = nil
currentRoom = "Main Party Room"
poses.CalebMainPartyRoom.Parent = currentPose
currentPose.CalebDoor.Parent = poses
else
local player = game.Players:GetPlayerFromCharacter()
player:Kick()
end
end
moveChances = math.random(1,20)
if moveChances <= botLevel then
if currentRoom == "Parts And Service" then
roomOption = 1
if roomOption == 1 then
moveChances = nil
currentRoom = "Main Party Room"
poses.CalebMainPartyRoom.Parent = currentPose
currentPose.CalebPartsAndService.Parent = poses
end
end
end
end
end
end
end
end
end

3 comments
Is this script parented to a value?
no, does that help?
i forgot to add .value to that line but ik what u mean